﻿using FAfx.SpectrumFish.Interfaces.Hardware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Num = System.Int32;

namespace FAfx.SpectrumFish.Hardware
{
    internal partial class Z80
    {
        //IZ80 this;
        internal void InitOpcodes()
        {
            Func<Num, Num> sign_extend = v => v < 128 ? v : v - 256;
            Action fnDoNuffink = () => { };
            var lookupTables = new
            {
                halfcarry_add = new Num[] { 0, 0x10, 0x10, 0x10, 0, 0, 0, 0x10 },
                halfcarry_sub = new Num[] { 0, 0, 0x10, 0, 0x10, 0, 0x10, 0x10 },
                overflow_add = new Num[] { 0, 0, 0, 0x04, 0x04, 0, 0, 0 },
                overflow_sub = new Num[] { 0, 0x04, 0, 0, 0, 0, 0x04, 0 },
                sz53 = new Num[0x100],
                parity = new Num[0x100],
                sz53p = new Num[0x100]
            };

            for (Num i = 0; i < 0x100; i++)
            {
                lookupTables.sz53[i] = i & (0x08 | 0x20 | 0x80);
                Num j = i, parity = 0;

                for (Num k = 0; k < 8; k++) { parity ^= j & 1; j >>= 1; }
                lookupTables.parity[i] = (parity > 0 ? 0 : 0x04);
                lookupTables.sz53p[i] = lookupTables.sz53[i] | lookupTables.parity[i];
            }
            lookupTables.sz53[0] |= 0x40;
            lookupTables.sz53p[0] |= 0x40;

            //            //--------------------------------------------;
            var DDCB_Opcodes = new Dictionary<Num, Action<Num>>();
            #region DDCB Opcodes
            //--------------------------------------------;
            var fnDDCB0x47 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 0)) > 0)) this.f |= 0x04 | 0x40;
                if (0 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x4f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 1)) > 0)) this.f |= 0x04 | 0x40;
                if (1 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x57 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 2)) > 0)) this.f |= 0x04 | 0x40;
                if (2 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x5f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 3)) > 0)) this.f |= 0x04 | 0x40;
                if (3 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x67 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 4)) > 0)) this.f |= 0x04 | 0x40;
                if (4 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x6f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                Num bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 5)) > 0)) this.f |= 0x04 | 0x40;
                if (5 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x77 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 6)) > 0)) this.f |= 0x04 | 0x40;
                if (6 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnDDCB0x7f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (7 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            //--------------------------------------------;
            DDCB_Opcodes.Add(0x00, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.b = ((this.b & 0x7f) << 1) | (this.b >> 7);
                this.f = (this.b & 0x01) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x01, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.c = ((this.c & 0x7f) << 1) | (this.c >> 7);
                this.f = (this.c & 0x01) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x02, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.d = ((this.d & 0x7f) << 1) | (this.d >> 7);
                this.f = (this.d & 0x01) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x03, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.e = ((this.e & 0x7f) << 1) | (this.e >> 7);
                this.f = (this.e & 0x01) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x04, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.h = ((this.h & 0x7f) << 1) | (this.h >> 7);
                this.f = (this.h & 0x01) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x05, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.l = ((this.l & 0x7f) << 1) | (this.l >> 7);
                this.f = (this.l & 0x01) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x06, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                bytetemp = ((bytetemp & 0x7f) << 1) | (bytetemp >> 7);
                this.f = (bytetemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x07, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.a = ((this.a & 0x7f) << 1) | (this.a >> 7);
                this.f = (this.a & 0x01) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x08, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b = (this.b >> 1) | ((this.b & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x09, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c = (this.c >> 1) | ((this.c & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x0a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d = (this.d >> 1) | ((this.d & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x0b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e = (this.e >> 1) | ((this.e & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x0c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h = (this.h >> 1) | ((this.h & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x0d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l = (this.l >> 1) | ((this.l & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x0e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp >> 1) | ((bytetemp & 0x01) << 7);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x0f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a = (this.a >> 1) | ((this.a & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x10, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                var rltemp = this.b;
                this.b = ((this.b & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x11, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                var rltemp = this.c;
                this.c = ((this.c & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x12, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                var rltemp = this.d;
                this.d = ((this.d & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x13, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                var rltemp = this.e;
                this.e = ((this.e & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x14, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                var rltemp = this.h;
                this.h = ((this.h & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x15, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                var rltemp = this.l;
                this.l = ((this.l & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x16, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                var rltemp = bytetemp;
                bytetemp = ((bytetemp & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x17, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                var rltemp = this.a;
                this.a = ((this.a & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x18, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                var rrtemp = this.b;
                this.b = (this.b >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x19, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                var rrtemp = this.c;
                this.c = (this.c >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x1a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                var rrtemp = this.d;
                this.d = (this.d >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x1b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                var rrtemp = this.e;
                this.e = (this.e >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x1c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                var rrtemp = this.h;
                this.h = (this.h >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x1d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                var rrtemp = this.l;
                this.l = (this.l >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x1e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                var rrtemp = bytetemp;
                bytetemp = (bytetemp >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x1f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                var rrtemp = this.a;
                this.a = (this.a >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x20, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b >> 7;
                this.b <<= 1;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x21, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c >> 7;
                this.c <<= 1;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x22, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d >> 7;
                this.d <<= 1;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x23, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e >> 7;
                this.e <<= 1;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x24, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h >> 7;
                this.h <<= 1;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x25, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l >> 7;
                this.l <<= 1;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x26, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp >> 7;
                bytetemp <<= 1;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x27, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a >> 7;
                this.a <<= 1;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x28, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b = (this.b & 0x80) | (this.b >> 1);
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x29, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c = (this.c & 0x80) | (this.c >> 1);
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x2a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d = (this.d & 0x80) | (this.d >> 1);
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x2b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e = (this.e & 0x80) | (this.e >> 1);
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x2c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h = (this.h & 0x80) | (this.h >> 1);
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x2d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l = (this.l & 0x80) | (this.l >> 1);
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x2e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp & 0x80) | (bytetemp >> 1);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x2f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a = (this.a & 0x80) | (this.a >> 1);
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x30, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b >> 7;
                this.b = (this.b << 1) | 0x01;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x31, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c >> 7;
                this.c = (this.c << 1) | 0x01;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x32, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d >> 7;
                this.d = (this.d << 1) | 0x01;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x33, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e >> 7;
                this.e = (this.e << 1) | 0x01;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x34, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h >> 7;
                this.h = (this.h << 1) | 0x01;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x35, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l >> 7;
                this.l = (this.l << 1) | 0x01;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x36, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp >> 7;
                bytetemp = (bytetemp << 1) | 0x01;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x37, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a >> 7;
                this.a = (this.a << 1) | 0x01;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x38, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b >>= 1;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x39, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c >>= 1;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x3a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d >>= 1;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x3b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e >>= 1;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x3c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h >>= 1;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x3d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l >>= 1;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x3e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp >>= 1;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            DDCB_Opcodes.Add(0x3f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a >>= 1;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x40, fnDDCB0x47);
            DDCB_Opcodes.Add(0x41, fnDDCB0x47);
            DDCB_Opcodes.Add(0x42, fnDDCB0x47);
            DDCB_Opcodes.Add(0x43, fnDDCB0x47);
            DDCB_Opcodes.Add(0x44, fnDDCB0x47);
            DDCB_Opcodes.Add(0x45, fnDDCB0x47);
            DDCB_Opcodes.Add(0x46, fnDDCB0x47);
            DDCB_Opcodes.Add(0x47, fnDDCB0x47);
            DDCB_Opcodes.Add(0x48, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x49, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4a, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4b, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4c, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4d, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4e, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x4f, fnDDCB0x4f);
            DDCB_Opcodes.Add(0x50, fnDDCB0x57);
            DDCB_Opcodes.Add(0x51, fnDDCB0x57);
            DDCB_Opcodes.Add(0x52, fnDDCB0x57);
            DDCB_Opcodes.Add(0x53, fnDDCB0x57);
            DDCB_Opcodes.Add(0x54, fnDDCB0x57);
            DDCB_Opcodes.Add(0x55, fnDDCB0x57);
            DDCB_Opcodes.Add(0x56, fnDDCB0x57);
            DDCB_Opcodes.Add(0x57, fnDDCB0x57);
            DDCB_Opcodes.Add(0x58, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x59, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5a, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5b, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5c, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5d, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5e, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x5f, fnDDCB0x5f);
            DDCB_Opcodes.Add(0x60, fnDDCB0x67);
            DDCB_Opcodes.Add(0x61, fnDDCB0x67);
            DDCB_Opcodes.Add(0x62, fnDDCB0x67);
            DDCB_Opcodes.Add(0x63, fnDDCB0x67);
            DDCB_Opcodes.Add(0x64, fnDDCB0x67);
            DDCB_Opcodes.Add(0x65, fnDDCB0x67);
            DDCB_Opcodes.Add(0x66, fnDDCB0x67);
            DDCB_Opcodes.Add(0x67, fnDDCB0x67);
            DDCB_Opcodes.Add(0x68, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x69, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6a, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6b, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6c, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6d, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6e, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x6f, fnDDCB0x6f);
            DDCB_Opcodes.Add(0x70, fnDDCB0x77);
            DDCB_Opcodes.Add(0x71, fnDDCB0x77);
            DDCB_Opcodes.Add(0x72, fnDDCB0x77);
            DDCB_Opcodes.Add(0x73, fnDDCB0x77);
            DDCB_Opcodes.Add(0x74, fnDDCB0x77);
            DDCB_Opcodes.Add(0x75, fnDDCB0x77);
            DDCB_Opcodes.Add(0x76, fnDDCB0x77);
            DDCB_Opcodes.Add(0x77, fnDDCB0x77);
            DDCB_Opcodes.Add(0x78, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x79, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7a, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7b, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7c, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7d, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7e, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x7f, fnDDCB0x7f);
            DDCB_Opcodes.Add(0x80, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x81, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x82, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x83, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x84, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x85, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x86, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfe);
            }));
            DDCB_Opcodes.Add(0x87, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x88, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x89, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x8a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x8b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x8c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x8d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x8e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfd);
            }));
            DDCB_Opcodes.Add(0x8f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x90, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x91, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x92, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x93, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x94, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x95, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x96, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfb);
            }));
            DDCB_Opcodes.Add(0x97, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0x98, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0x99, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0x9a, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0x9b, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0x9c, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0x9d, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0x9e, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xf7);
            }));
            DDCB_Opcodes.Add(0x9f, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xa0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xa1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xa2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xa3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xa4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xa5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xa6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xef);
            }));
            DDCB_Opcodes.Add(0xa7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xa8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xa9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xaa, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xab, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xac, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xad, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xae, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xdf);
            }));
            DDCB_Opcodes.Add(0xaf, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xb0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xb1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xb2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xb3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xb4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xb5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xb6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xbf);
            }));
            DDCB_Opcodes.Add(0xb7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xb8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xb9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xba, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xbb, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xbc, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xbd, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xbe, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0x7f);
            }));
            DDCB_Opcodes.Add(0xbf, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xc0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xc1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xc2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xc3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xc4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xc5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xc6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x01);
            }));
            DDCB_Opcodes.Add(0xc7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xc8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xc9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xca, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xcb, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xcc, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xcd, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xce, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x02);
            }));
            DDCB_Opcodes.Add(0xcf, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xd0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xd1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xd2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xd3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xd4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xd5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xd6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x04);
            }));
            DDCB_Opcodes.Add(0xd7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xd8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xd9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xda, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xdb, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xdc, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xdd, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xde, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x08);
            }));
            DDCB_Opcodes.Add(0xdf, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xe0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xe1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xe2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xe3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xe4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xe5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xe6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x10);
            }));
            DDCB_Opcodes.Add(0xe7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xe8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xe9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xea, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xeb, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xec, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xed, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xee, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x20);
            }));
            DDCB_Opcodes.Add(0xef, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xf0, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xf1, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xf2, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xf3, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xf4, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xf5, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xf6, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x40);
            }));
            DDCB_Opcodes.Add(0xf7, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.a);
            }));
            DDCB_Opcodes.Add(0xf8, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.b);
            }));
            DDCB_Opcodes.Add(0xf9, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.c);
            }));
            DDCB_Opcodes.Add(0xfa, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.d);
            }));
            DDCB_Opcodes.Add(0xfb, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.e);
            }));
            DDCB_Opcodes.Add(0xfc, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.h);
            }));
            DDCB_Opcodes.Add(0xfd, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.l);
            }));
            DDCB_Opcodes.Add(0xfe, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x80);
            }));
            DDCB_Opcodes.Add(0xff, new Action<Num>(tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.a);
            }));

            #endregion

            var CB_Opcodes = new Dictionary<Num, Action>();
            #region CB OpCodes
            CB_Opcodes.Add(0x00, new Action(() =>
            {
                this.b = ((this.b & 0x7f) << 1) | (this.b >> 7);
                this.f = (this.b & 0x01) | lookupTables.sz53p[this.b];
            }));

            CB_Opcodes.Add(0x01, new Action(() =>
            {
                this.c = ((this.c & 0x7f) << 1) | (this.c >> 7);
                this.f = (this.c & 0x01) | lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x02, new Action(() =>
            {
                this.d = ((this.d & 0x7f) << 1) | (this.d >> 7);
                this.f = (this.d & 0x01) | lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x03, new Action(() =>
            {
                this.e = ((this.e & 0x7f) << 1) | (this.e >> 7);
                this.f = (this.e & 0x01) | lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x04, new Action(() =>
            {
                this.h = ((this.h & 0x7f) << 1) | (this.h >> 7);
                this.f = (this.h & 0x01) | lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x05, new Action(() =>
            {
                this.l = ((this.l & 0x7f) << 1) | (this.l >> 7);
                this.f = (this.l & 0x01) | lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x06, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                bytetemp = ((bytetemp & 0x7f) << 1) | (bytetemp >> 7);
                this.f = (bytetemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x07, new Action(() =>
            {
                this.a = ((this.a & 0x7f) << 1) | (this.a >> 7);
                this.f = (this.a & 0x01) | lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x08, new Action(() =>
            {
                this.f = this.b & 0x01;
                this.b = (this.b >> 1) | ((this.b & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x09, new Action(() =>
            {
                this.f = this.c & 0x01;
                this.c = (this.c >> 1) | ((this.c & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x0a, new Action(() =>
            {
                this.f = this.d & 0x01;
                this.d = (this.d >> 1) | ((this.d & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x0b, new Action(() =>
            {
                this.f = this.e & 0x01;
                this.e = (this.e >> 1) | ((this.e & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x0c, new Action(() =>
            {
                this.f = this.h & 0x01;
                this.h = (this.h >> 1) | ((this.h & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x0d, new Action(() =>
            {
                this.f = this.l & 0x01;
                this.l = (this.l >> 1) | ((this.l & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x0e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp >> 1) | ((bytetemp & 0x01) << 7);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x0f, new Action(() =>
            {
                this.f = this.a & 0x01;
                this.a = (this.a >> 1) | ((this.a & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x10, new Action(() =>
            {
                var rltemp = this.b;
                this.b = ((this.b & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x11, new Action(() =>
            {
                var rltemp = this.c;
                this.c = ((this.c & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x12, new Action(() =>
            {
                var rltemp = this.d;
                this.d = ((this.d & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x13, new Action(() =>
            {
                var rltemp = this.e;
                this.e = ((this.e & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x14, new Action(() =>
            {
                var rltemp = this.h;
                this.h = ((this.h & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x15, new Action(() =>
            {
                var rltemp = this.l;
                this.l = ((this.l & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x16, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                var rltemp = bytetemp;
                bytetemp = ((bytetemp & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x17, new Action(() =>
            {
                var rltemp = this.a;
                this.a = ((this.a & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x18, new Action(() =>
            {
                var rrtemp = this.b;
                this.b = (this.b >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x19, new Action(() =>
            {
                var rrtemp = this.c;
                this.c = (this.c >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x1a, new Action(() =>
            {
                var rrtemp = this.d;
                this.d = (this.d >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x1b, new Action(() =>
            {
                var rrtemp = this.e;
                this.e = (this.e >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x1c, new Action(() =>
            {
                var rrtemp = this.h;
                this.h = (this.h >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x1d, new Action(() =>
            {
                var rrtemp = this.l;
                this.l = (this.l >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x1e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                var rrtemp = bytetemp;
                bytetemp = (bytetemp >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x1f, new Action(() =>
            {
                var rrtemp = this.a;
                this.a = (this.a >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x20, new Action(() =>
            {
                this.f = this.b >> 7;
                this.b <<= 1;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x21, new Action(() =>
            {
                this.f = this.c >> 7;
                this.c <<= 1;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x22, new Action(() =>
            {
                this.f = this.d >> 7;
                this.d <<= 1;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x23, new Action(() =>
            {
                this.f = this.e >> 7;
                this.e <<= 1;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x24, new Action(() =>
            {
                this.f = this.h >> 7;
                this.h <<= 1;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x25, new Action(() =>
            {
                this.f = this.l >> 7;
                this.l <<= 1;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x26, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                this.f = bytetemp >> 7;
                bytetemp <<= 1;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x27, new Action(() =>
            {
                this.f = this.a >> 7;
                this.a <<= 1;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x28, new Action(() =>
            {
                this.f = this.b & 0x01;
                this.b = (this.b & 0x80) | (this.b >> 1);
                this.f |= lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x29, new Action(() =>
            {
                this.f = this.c & 0x01;
                this.c = (this.c & 0x80) | (this.c >> 1);
                this.f |= lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x2a, new Action(() =>
            {
                this.f = this.d & 0x01;
                this.d = (this.d & 0x80) | (this.d >> 1);
                this.f |= lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x2b, new Action(() =>
            {
                this.f = this.e & 0x01;
                this.e = (this.e & 0x80) | (this.e >> 1);
                this.f |= lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x2c, new Action(() =>
            {
                this.f = this.h & 0x01;
                this.h = (this.h & 0x80) | (this.h >> 1);
                this.f |= lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x2d, new Action(() =>
            {
                this.f = this.l & 0x01;
                this.l = (this.l & 0x80) | (this.l >> 1);
                this.f |= lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x2e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp & 0x80) | (bytetemp >> 1);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x2f, new Action(() =>
            {
                this.f = this.a & 0x01;
                this.a = (this.a & 0x80) | (this.a >> 1);
                this.f |= lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x30, new Action(() =>
            {
                this.f = this.b >> 7;
                this.b = (this.b << 1) | 0x01;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x31, new Action(() =>
            {
                this.f = this.c >> 7;
                this.c = (this.c << 1) | 0x01;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x32, new Action(() =>
            {
                this.f = this.d >> 7;
                this.d = (this.d << 1) | 0x01;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x33, new Action(() =>
            {
                this.f = this.e >> 7;
                this.e = (this.e << 1) | 0x01;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x34, new Action(() =>
            {
                this.f = this.h >> 7;
                this.h = (this.h << 1) | 0x01;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x35, new Action(() =>
            {
                this.f = this.l >> 7;
                this.l = (this.l << 1) | 0x01;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x36, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                this.f = bytetemp >> 7;
                bytetemp = (bytetemp << 1) | 0x01;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x37, new Action(() =>
            {
                this.f = this.a >> 7;
                this.a = (this.a << 1) | 0x01;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x38, new Action(() =>
            {
                this.f = this.b & 0x01;
                this.b >>= 1;
                this.f |= lookupTables.sz53p[this.b];
            }));
            CB_Opcodes.Add(0x39, new Action(() =>
            {
                this.f = this.c & 0x01;
                this.c >>= 1;
                this.f |= lookupTables.sz53p[this.c];
            }));
            CB_Opcodes.Add(0x3a, new Action(() =>
            {
                this.f = this.d & 0x01;
                this.d >>= 1;
                this.f |= lookupTables.sz53p[this.d];
            }));
            CB_Opcodes.Add(0x3b, new Action(() =>
            {
                this.f = this.e & 0x01;
                this.e >>= 1;
                this.f |= lookupTables.sz53p[this.e];
            }));
            CB_Opcodes.Add(0x3c, new Action(() =>
            {
                this.f = this.h & 0x01;
                this.h >>= 1;
                this.f |= lookupTables.sz53p[this.h];
            }));
            CB_Opcodes.Add(0x3d, new Action(() =>
            {
                this.f = this.l & 0x01;
                this.l >>= 1;
                this.f |= lookupTables.sz53p[this.l];
            }));
            CB_Opcodes.Add(0x3e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 7;
                this.f = bytetemp & 0x01;
                bytetemp >>= 1;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            CB_Opcodes.Add(0x3f, new Action(() =>
            {
                this.f = this.a & 0x01;
                this.a >>= 1;
                this.f |= lookupTables.sz53p[this.a];
            }));
            CB_Opcodes.Add(0x40, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x41, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x42, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x43, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x44, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 0)) > 0)) this.f |= 0x04 | 0x40;
            }));
            CB_Opcodes.Add(0x45, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x46, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x47, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 0)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x48, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x49, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4a, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4b, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4c, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4d, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x4f, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 1)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x50, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x51, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x52, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x53, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x54, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x55, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x56, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x57, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 2)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x58, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x59, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5a, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5b, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5c, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5d, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x5f, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 3)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x60, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x61, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x62, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x63, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x64, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x65, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x66, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x67, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 4)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x68, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x69, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6a, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6b, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6c, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6d, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x6f, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 5)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x70, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x71, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x72, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x73, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x74, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x75, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x76, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x77, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 6)) > 0)) { this.f |= 0x04 | 0x40; }
            }));
            CB_Opcodes.Add(0x78, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.b & (0x08 | 0x20));
                if (!((this.b & (0x01 << 7)) > 0)) { this.f |= 0x04 | 0x40; }
                if (true && (this.b & 0x80) > 0) { this.f |= 0x80; }
            }));
            CB_Opcodes.Add(0x79, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.c & (0x08 | 0x20));
                if (!((this.c & (0x01 << 7)) > 0)) { this.f |= 0x04 | 0x40; }
                if (true && (this.c & 0x80) > 0) { this.f |= 0x80; }
            }));
            CB_Opcodes.Add(0x7a, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.d & (0x08 | 0x20));
                if (!((this.d & (0x01 << 7)) > 0)) { this.f |= 0x04 | 0x40; }
                if (true && (this.d & 0x80) > 0) { this.f |= 0x80; }
            }));
            CB_Opcodes.Add(0x7b, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.e & (0x08 | 0x20));
                if (!((this.e & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (true && (this.e & 0x80) > 0) this.f |= 0x80;
            }));
            CB_Opcodes.Add(0x7c, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.h & (0x08 | 0x20));
                if (!((this.h & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (true && (this.h & 0x80) > 0) this.f |= 0x80;
            }));
            CB_Opcodes.Add(0x7d, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.l & (0x08 | 0x20));
                if (!((this.l & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (true && (this.l & 0x80) > 0) this.f |= 0x80;
            }));
            CB_Opcodes.Add(0x7e, new Action(() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 4;
                this.f = (this.f & 0x01) | 0x10 | (bytetemp & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (true && (bytetemp & 0x80) > 0) this.f |= 0x80;
            }));
            CB_Opcodes.Add(0x7f, new Action(() =>
            {
                this.f = (this.f & 0x01) | 0x10 | (this.a & (0x08 | 0x20));
                if (!((this.a & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (true && (this.a & 0x80) > 0) this.f |= 0x80;
            }));
            CB_Opcodes.Add(0x80, new Action(() =>
            {
                this.b &= 0xfe;
            }));
            CB_Opcodes.Add(0x81, new Action(() =>
            {
                this.c &= 0xfe;
            }));
            CB_Opcodes.Add(0x82, new Action(() =>
            {
                this.d &= 0xfe;
            }));
            CB_Opcodes.Add(0x83, new Action(() =>
            {
                this.e &= 0xfe;
            }));
            CB_Opcodes.Add(0x84, new Action(() =>
            {
                this.h &= 0xfe;
            }));
            CB_Opcodes.Add(0x85, new Action(() =>
            {
                this.l &= 0xfe;
            }));
            CB_Opcodes.Add(0x86, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xfe);
            }));
            CB_Opcodes.Add(0x87, new Action(() =>
            {
                this.a &= 0xfe;
            }));
            CB_Opcodes.Add(0x88, new Action(() =>
            {
                this.b &= 0xfd;
            }));
            CB_Opcodes.Add(0x89, new Action(() =>
            {
                this.c &= 0xfd;
            }));
            CB_Opcodes.Add(0x8a, new Action(() =>
            {
                this.d &= 0xfd;
            }));
            CB_Opcodes.Add(0x8b, new Action(() =>
            {
                this.e &= 0xfd;
            }));
            CB_Opcodes.Add(0x8c, new Action(() =>
            {
                this.h &= 0xfd;
            }));
            CB_Opcodes.Add(0x8d, new Action(() =>
            {
                this.l &= 0xfd;
            }));
            CB_Opcodes.Add(0x8e, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xfd);
            }));
            CB_Opcodes.Add(0x8f, new Action(() =>
            {
                this.a &= 0xfd;
            }));
            CB_Opcodes.Add(0x90, new Action(() =>
            {
                this.b &= 0xfb;
            }));
            CB_Opcodes.Add(0x91, new Action(() =>
            {
                this.c &= 0xfb;
            }));
            CB_Opcodes.Add(0x92, new Action(() =>
            {
                this.d &= 0xfb;
            }));
            CB_Opcodes.Add(0x93, new Action(() =>
            {
                this.e &= 0xfb;
            }));
            CB_Opcodes.Add(0x94, new Action(() =>
            {
                this.h &= 0xfb;
            }));
            CB_Opcodes.Add(0x95, new Action(() =>
            {
                this.l &= 0xfb;
            }));
            CB_Opcodes.Add(0x96, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xfb);
            }));
            CB_Opcodes.Add(0x97, new Action(() =>
            {
                this.a &= 0xfb;
            }));
            CB_Opcodes.Add(0x98, new Action(() =>
            {
                this.b &= 0xf7;
            }));
            CB_Opcodes.Add(0x99, new Action(() =>
            {
                this.c &= 0xf7;
            }));
            CB_Opcodes.Add(0x9a, new Action(() =>
            {
                this.d &= 0xf7;
            }));
            CB_Opcodes.Add(0x9b, new Action(() =>
            {
                this.e &= 0xf7;
            }));
            CB_Opcodes.Add(0x9c, new Action(() =>
            {
                this.h &= 0xf7;
            }));
            CB_Opcodes.Add(0x9d, new Action(() =>
            {
                this.l &= 0xf7;
            }));
            CB_Opcodes.Add(0x9e, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xf7);
            }));
            CB_Opcodes.Add(0x9f, new Action(() =>
            {
                this.a &= 0xf7;
            }));
            CB_Opcodes.Add(0xa0, new Action(() =>
            {
                this.b &= 0xef;
            }));
            CB_Opcodes.Add(0xa1, new Action(() =>
            {
                this.c &= 0xef;
            }));
            CB_Opcodes.Add(0xa2, new Action(() =>
            {
                this.d &= 0xef;
            }));
            CB_Opcodes.Add(0xa3, new Action(() =>
            {
                this.e &= 0xef;
            }));
            CB_Opcodes.Add(0xa4, new Action(() =>
            {
                this.h &= 0xef;
            }));
            CB_Opcodes.Add(0xa5, new Action(() =>
            {
                this.l &= 0xef;
            }));
            CB_Opcodes.Add(0xa6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xef);
            }));
            CB_Opcodes.Add(0xa7, new Action(() =>
            {
                this.a &= 0xef;
            }));
            CB_Opcodes.Add(0xa8, new Action(() =>
            {
                this.b &= 0xdf;
            }));
            CB_Opcodes.Add(0xa9, new Action(() =>
            {
                this.c &= 0xdf;
            }));
            CB_Opcodes.Add(0xaa, new Action(() =>
            {
                this.d &= 0xdf;
            }));
            CB_Opcodes.Add(0xab, new Action(() =>
            {
                this.e &= 0xdf;
            }));
            CB_Opcodes.Add(0xac, new Action(() =>
            {
                this.h &= 0xdf;
            }));
            CB_Opcodes.Add(0xad, new Action(() =>
            {
                this.l &= 0xdf;
            }));
            CB_Opcodes.Add(0xae, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xdf);
            }));
            CB_Opcodes.Add(0xaf, new Action(() =>
            {
                this.a &= 0xdf;
            }));
            CB_Opcodes.Add(0xb0, new Action(() =>
            {
                this.b &= 0xbf;
            }));
            CB_Opcodes.Add(0xb1, new Action(() =>
            {
                this.c &= 0xbf;
            }));
            CB_Opcodes.Add(0xb2, new Action(() =>
            {
                this.d &= 0xbf;
            }));
            CB_Opcodes.Add(0xb3, new Action(() =>
            {
                this.e &= 0xbf;
            }));
            CB_Opcodes.Add(0xb4, new Action(() =>
            {
                this.h &= 0xbf;
            }));
            CB_Opcodes.Add(0xb5, new Action(() =>
            {
                this.l &= 0xbf;
            }));
            CB_Opcodes.Add(0xb6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0xbf);
            }));
            CB_Opcodes.Add(0xb7, new Action(() =>
            {
                this.a &= 0xbf;
            }));
            CB_Opcodes.Add(0xb8, new Action(() =>
            {
                this.b &= 0x7f;
            }));
            CB_Opcodes.Add(0xb9, new Action(() =>
            {
                this.c &= 0x7f;
            }));
            CB_Opcodes.Add(0xba, new Action(() =>
            {
                this.d &= 0x7f;
            }));
            CB_Opcodes.Add(0xbb, new Action(() =>
            {
                this.e &= 0x7f;
            }));
            CB_Opcodes.Add(0xbc, new Action(() =>
            {
                this.h &= 0x7f;
            }));
            CB_Opcodes.Add(0xbd, new Action(() =>
            {
                this.l &= 0x7f;
            }));
            CB_Opcodes.Add(0xbe, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) & 0x7f);
            }));
            CB_Opcodes.Add(0xbf, new Action(() =>
            {
                this.a &= 0x7f;
            }));
            CB_Opcodes.Add(0xc0, new Action(() =>
            {
                this.b |= 0x01;
            }));
            CB_Opcodes.Add(0xc1, new Action(() =>
            {
                this.c |= 0x01;
            }));
            CB_Opcodes.Add(0xc2, new Action(() =>
            {
                this.d |= 0x01;
            }));
            CB_Opcodes.Add(0xc3, new Action(() =>
            {
                this.e |= 0x01;
            }));
            CB_Opcodes.Add(0xc4, new Action(() =>
            {
                this.h |= 0x01;
            }));
            CB_Opcodes.Add(0xc5, new Action(() =>
            {
                this.l |= 0x01;
            }));
            CB_Opcodes.Add(0xc6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x01);
            }));
            CB_Opcodes.Add(0xc7, new Action(() =>
            {
                this.a |= 0x01;
            }));
            CB_Opcodes.Add(0xc8, new Action(() =>
            {
                this.b |= 0x02;
            }));
            CB_Opcodes.Add(0xc9, new Action(() =>
            {
                this.c |= 0x02;
            }));
            CB_Opcodes.Add(0xca, new Action(() =>
            {
                this.d |= 0x02;
            }));
            CB_Opcodes.Add(0xcb, new Action(() =>
            {
                this.e |= 0x02;
            }));
            CB_Opcodes.Add(0xcc, new Action(() =>
            {
                this.h |= 0x02;
            }));
            CB_Opcodes.Add(0xcd, new Action(() =>
            {
                this.l |= 0x02;
            }));
            CB_Opcodes.Add(0xce, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x02);
            }));
            CB_Opcodes.Add(0xcf, new Action(() =>
            {
                this.a |= 0x02;
            }));
            CB_Opcodes.Add(0xd0, new Action(() =>
            {
                this.b |= 0x04;
            }));
            CB_Opcodes.Add(0xd1, new Action(() =>
            {
                this.c |= 0x04;
            }));
            CB_Opcodes.Add(0xd2, new Action(() =>
            {
                this.d |= 0x04;
            }));
            CB_Opcodes.Add(0xd3, new Action(() =>
            {
                this.e |= 0x04;
            }));
            CB_Opcodes.Add(0xd4, new Action(() =>
            {
                this.h |= 0x04;
            }));
            CB_Opcodes.Add(0xd5, new Action(() =>
            {
                this.l |= 0x04;
            }));
            CB_Opcodes.Add(0xd6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x04);
            }));
            CB_Opcodes.Add(0xd7, new Action(() =>
            {
                this.a |= 0x04;
            }));
            CB_Opcodes.Add(0xd8, new Action(() =>
            {
                this.b |= 0x08;
            }));
            CB_Opcodes.Add(0xd9, new Action(() =>
            {
                this.c |= 0x08;
            }));
            CB_Opcodes.Add(0xda, new Action(() =>
            {
                this.d |= 0x08;
            }));
            CB_Opcodes.Add(0xdb, new Action(() =>
            {
                this.e |= 0x08;
            }));
            CB_Opcodes.Add(0xdc, new Action(() =>
            {
                this.h |= 0x08;
            }));
            CB_Opcodes.Add(0xdd, new Action(() =>
            {
                this.l |= 0x08;
            }));
            CB_Opcodes.Add(0xde, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x08);
            }));
            CB_Opcodes.Add(0xdf, new Action(() =>
            {
                this.a |= 0x08;
            }));
            CB_Opcodes.Add(0xe0, new Action(() =>
            {
                this.b |= 0x10;
            }));
            CB_Opcodes.Add(0xe1, new Action(() =>
            {
                this.c |= 0x10;
            }));
            CB_Opcodes.Add(0xe2, new Action(() =>
            {
                this.d |= 0x10;
            }));
            CB_Opcodes.Add(0xe3, new Action(() =>
            {
                this.e |= 0x10;
            }));
            CB_Opcodes.Add(0xe4, new Action(() =>
            {
                this.h |= 0x10;
            }));
            CB_Opcodes.Add(0xe5, new Action(() =>
            {
                this.l |= 0x10;
            }));
            CB_Opcodes.Add(0xe6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x10);
            }));
            CB_Opcodes.Add(0xe7, new Action(() =>
            {
                this.a |= 0x10;
            }));
            CB_Opcodes.Add(0xe8, new Action(() =>
            {
                this.b |= 0x20;
            }));
            CB_Opcodes.Add(0xe9, new Action(() =>
            {
                this.c |= 0x20;
            }));
            CB_Opcodes.Add(0xea, new Action(() =>
            {
                this.d |= 0x20;
            }));
            CB_Opcodes.Add(0xeb, new Action(() =>
            {
                this.e |= 0x20;
            }));
            CB_Opcodes.Add(0xec, new Action(() =>
            {
                this.h |= 0x20;
            }));
            CB_Opcodes.Add(0xed, new Action(() =>
            {
                this.l |= 0x20;
            }));
            CB_Opcodes.Add(0xee, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x20);
            }));
            CB_Opcodes.Add(0xef, new Action(() =>
            {
                this.a |= 0x20;
            }));
            CB_Opcodes.Add(0xf0, new Action(() =>
            {
                this.b |= 0x40;
            }));
            CB_Opcodes.Add(0xf1, new Action(() =>
            {
                this.c |= 0x40;
            }));
            CB_Opcodes.Add(0xf2, new Action(() =>
            {
                this.d |= 0x40;
            }));
            CB_Opcodes.Add(0xf3, new Action(() =>
            {
                this.e |= 0x40;
            }));
            CB_Opcodes.Add(0xf4, new Action(() =>
            {
                this.h |= 0x40;
            }));
            CB_Opcodes.Add(0xf5, new Action(() =>
            {
                this.l |= 0x40;
            }));
            CB_Opcodes.Add(0xf6, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x40);
            }));
            CB_Opcodes.Add(0xf7, new Action(() =>
            {
                this.a |= 0x40;
            }));
            CB_Opcodes.Add(0xf8, new Action(() =>
            {
                this.b |= 0x80;
            }));
            CB_Opcodes.Add(0xf9, new Action(() =>
            {
                this.c |= 0x80;
            }));
            CB_Opcodes.Add(0xfa, new Action(() =>
            {
                this.d |= 0x80;
            }));
            CB_Opcodes.Add(0xfb, new Action(() =>
            {
                this.e |= 0x80;
            }));
            CB_Opcodes.Add(0xfc, new Action(() =>
            {
                this.h |= 0x80;
            }));
            CB_Opcodes.Add(0xfd, new Action(() =>
            {
                this.l |= 0x80;
            }));
            CB_Opcodes.Add(0xfe, new Action(() =>
            {
                this.tstates += 7;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte((this.l | (this.h << 8))) | 0x80);
            }));
            CB_Opcodes.Add(0xff, new Action(() =>
            {
                this.a |= 0x80;
            }));
            #endregion

            //    //--------------------------------------------;
            var DD_Opcodes = new Dictionary<Num, Action>();
            #region DD Opcodes
            //--------------------------------------------;
            var fnDDdefault = new Action(() =>
            {
                this.pc--;
                this.pc &= 0xffff;
                this.r--;
                this.r &= 0x7f;
            });
            //--------------------------------------------;
            DD_Opcodes.Add(0x00, fnDDdefault);

            DD_Opcodes.Add(0x01, fnDDdefault);
            DD_Opcodes.Add(0x02, fnDDdefault);
            DD_Opcodes.Add(0x03, fnDDdefault);
            DD_Opcodes.Add(0x04, fnDDdefault);
            DD_Opcodes.Add(0x05, fnDDdefault);
            DD_Opcodes.Add(0x06, fnDDdefault);
            DD_Opcodes.Add(0x07, fnDDdefault);
            DD_Opcodes.Add(0x08, fnDDdefault);
            DD_Opcodes.Add(0x09, new Action(() =>
            {
                var add16temp = ((this.ixl | (this.ixh << 8))) + ((this.c | (this.b << 8)));
                var lookup = ((((this.ixl | (this.ixh << 8))) & 0x0800) >> 11) | ((((this.c | (this.b << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.ixh = (add16temp >> 8) & 0xff;
                this.ixl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | ((add16temp & 0x10000) > 0 ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            DD_Opcodes.Add(0x0a, fnDDdefault);
            DD_Opcodes.Add(0x0b, fnDDdefault);
            DD_Opcodes.Add(0x0c, fnDDdefault);
            DD_Opcodes.Add(0x0d, fnDDdefault);
            DD_Opcodes.Add(0x0e, fnDDdefault);
            DD_Opcodes.Add(0x0f, fnDDdefault);
            DD_Opcodes.Add(0x10, fnDDdefault);
            DD_Opcodes.Add(0x11, fnDDdefault);
            DD_Opcodes.Add(0x12, fnDDdefault);
            DD_Opcodes.Add(0x13, fnDDdefault);
            DD_Opcodes.Add(0x14, fnDDdefault);
            DD_Opcodes.Add(0x15, fnDDdefault);
            DD_Opcodes.Add(0x16, fnDDdefault);
            DD_Opcodes.Add(0x17, fnDDdefault);
            DD_Opcodes.Add(0x18, fnDDdefault);
            DD_Opcodes.Add(0x19, new Action(() =>
            {
                var add16temp = ((this.ixl | (this.ixh << 8))) + ((this.e | (this.d << 8)));
                var lookup = ((((this.ixl | (this.ixh << 8))) & 0x0800) >> 11) | ((((this.e | (this.d << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.ixh = (add16temp >> 8) & 0xff;
                this.ixl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | ((add16temp & 0x10000) > 0 ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            DD_Opcodes.Add(0x1a, fnDDdefault);
            DD_Opcodes.Add(0x1b, fnDDdefault);
            DD_Opcodes.Add(0x1c, fnDDdefault);
            DD_Opcodes.Add(0x1d, fnDDdefault);
            DD_Opcodes.Add(0x1e, fnDDdefault);
            DD_Opcodes.Add(0x1f, fnDDdefault);
            DD_Opcodes.Add(0x20, fnDDdefault);
            DD_Opcodes.Add(0x21, new Action(() =>
            {
                this.tstates += 3;
                this.ixl = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.ixh = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x22, new Action(() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.ixl);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.ixh);
            }));
            DD_Opcodes.Add(0x23, new Action(() =>
            {
                this.tstates += 2;
                var wordtemp = ((this.ixl | (this.ixh << 8)) + 1) & 0xffff;
                this.ixh = wordtemp >> 8;
                this.ixl = wordtemp & 0xff;
            }));
            DD_Opcodes.Add(0x24, new Action(() =>
            {
                this.ixh = (this.ixh + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.ixh == 0x80 ? 0x04 : 0) | ((this.ixh & 0x0f) > 0 ? 0 : 0x10) | lookupTables.sz53[this.ixh];
            }));
            DD_Opcodes.Add(0x25, new Action(() =>
            {
                this.f = (this.f & 0x01) | ((this.ixh & 0x0f) > 0 ? 0 : 0x10) | 0x02;
                this.ixh = (this.ixh - 1) & 0xff;
                this.f |= (this.ixh == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.ixh];
            }));
            DD_Opcodes.Add(0x26, new Action(() =>
            {
                this.tstates += 3;
                this.ixh = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x27, fnDDdefault);
            DD_Opcodes.Add(0x28, fnDDdefault);
            DD_Opcodes.Add(0x29, new Action(() =>
            {
                Num add16temp = ((this.ixl | (this.ixh << 8))) + ((this.ixl | (this.ixh << 8))),
                    lookup = ((((this.ixl | (this.ixh << 8))) & 0x0800) >> 11) | ((((this.ixl | (this.ixh << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.ixh = (add16temp >> 8) & 0xff;
                this.ixl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | ((add16temp & 0x10000) > 0 ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            DD_Opcodes.Add(0x2a, new Action(() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.ixl = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.ixh = this.memory.readbyte(ldtemp);
            }));
            DD_Opcodes.Add(0x2b, new Action(() =>
            {
                this.tstates += 2;
                var wordtemp = ((this.ixl | (this.ixh << 8)) - 1) & 0xffff;
                this.ixh = wordtemp >> 8;
                this.ixl = wordtemp & 0xff;
            }));
            DD_Opcodes.Add(0x2c, new Action(() =>
            {
                this.ixl = (this.ixl + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.ixl == 0x80 ? 0x04 : 0) | ((this.ixl & 0x0f) > 0 ? 0 : 0x10) | lookupTables.sz53[this.ixl];
            }));
            DD_Opcodes.Add(0x2d, new Action(() =>
            {
                this.f = (this.f & 0x01) | ((this.ixl & 0x0f) > 0 ? 0 : 0x10) | 0x02;
                this.ixl = (this.ixl - 1) & 0xff;
                this.f |= (this.ixl == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.ixl];
            }));
            DD_Opcodes.Add(0x2e, new Action(() =>
            {
                this.tstates += 3;
                this.ixl = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x2f, fnDDdefault);
            DD_Opcodes.Add(0x30, fnDDdefault);
            DD_Opcodes.Add(0x31, fnDDdefault);
            DD_Opcodes.Add(0x32, fnDDdefault);
            DD_Opcodes.Add(0x33, fnDDdefault);
            DD_Opcodes.Add(0x34, new Action(() =>
            {
                this.tstates += 15;
                var wordtemp = ((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                var bytetemp = this.memory.readbyte(wordtemp);
                bytetemp = (bytetemp + 1) & 0xff;
                this.f = (this.f & 0x01) | (bytetemp == 0x80 ? 0x04 : 0) | ((bytetemp & 0x0f) > 0 ? 0 : 0x10) | lookupTables.sz53[bytetemp];
                this.memory.writebyte(wordtemp, bytetemp);
            }));
            DD_Opcodes.Add(0x35, new Action(() =>
            {
                this.tstates += 15;
                var wordtemp = ((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                var bytetemp = this.memory.readbyte(wordtemp);
                this.f = (this.f & 0x01) | ((bytetemp & 0x0f) > 0 ? 0 : 0x10) | 0x02;
                bytetemp = (bytetemp - 1) & 0xff;
                this.f |= (bytetemp == 0x7f ? 0x04 : 0) | lookupTables.sz53[bytetemp];
                this.memory.writebyte(wordtemp, bytetemp);
            }));
            DD_Opcodes.Add(0x36, new Action(() =>
            {
                this.tstates += 11;
                var wordtemp = ((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                this.memory.writebyte(wordtemp, this.memory.readbyte(this.pc++));
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x37, fnDDdefault);
            DD_Opcodes.Add(0x38, fnDDdefault);
            DD_Opcodes.Add(0x39, new Action(() =>
            {
                Num add16temp = ((this.ixl | (this.ixh << 8))) + (this.sp),
                    lookup = ((((this.ixl | (this.ixh << 8))) & 0x0800) >> 11) | (((this.sp) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.ixh = (add16temp >> 8) & 0xff;
                this.ixl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | ((add16temp & 0x10000) > 0 ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            DD_Opcodes.Add(0x3a, fnDDdefault);
            DD_Opcodes.Add(0x3b, fnDDdefault);
            DD_Opcodes.Add(0x3c, fnDDdefault);
            DD_Opcodes.Add(0x3d, fnDDdefault);
            DD_Opcodes.Add(0x3e, fnDDdefault);
            DD_Opcodes.Add(0x3f, fnDDdefault);
            DD_Opcodes.Add(0x40, fnDDdefault);
            DD_Opcodes.Add(0x41, fnDDdefault);
            DD_Opcodes.Add(0x42, fnDDdefault);
            DD_Opcodes.Add(0x43, fnDDdefault);
            DD_Opcodes.Add(0x44, new Action(() =>
            {
                this.b = this.ixh;
            }));
            DD_Opcodes.Add(0x45, new Action(() =>
            {
                this.b = this.ixl;
            }));
            DD_Opcodes.Add(0x46, new Action(() =>
            {
                this.tstates += 11;
                this.b = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x47, fnDDdefault);
            DD_Opcodes.Add(0x48, fnDDdefault);
            DD_Opcodes.Add(0x49, fnDDdefault);
            DD_Opcodes.Add(0x4a, fnDDdefault);
            DD_Opcodes.Add(0x4b, fnDDdefault);
            DD_Opcodes.Add(0x4c, new Action(() =>
            {
                this.c = this.ixh;
            }));
            DD_Opcodes.Add(0x4d, new Action(() =>
            {
                this.c = this.ixl;
            }));
            DD_Opcodes.Add(0x4e, new Action(() =>
            {
                this.tstates += 11;
                this.c = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x4f, fnDDdefault);
            DD_Opcodes.Add(0x50, fnDDdefault);
            DD_Opcodes.Add(0x51, fnDDdefault);
            DD_Opcodes.Add(0x52, fnDDdefault);
            DD_Opcodes.Add(0x53, fnDDdefault);
            DD_Opcodes.Add(0x54, new Action(() =>
            {
                this.d = this.ixh;
            }));
            DD_Opcodes.Add(0x55, new Action(() =>
            {
                this.d = this.ixl;
            }));
            DD_Opcodes.Add(0x56, new Action(() =>
            {
                this.tstates += 11;
                this.d = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x57, fnDDdefault);
            DD_Opcodes.Add(0x58, fnDDdefault);
            DD_Opcodes.Add(0x59, fnDDdefault);
            DD_Opcodes.Add(0x5a, fnDDdefault);
            DD_Opcodes.Add(0x5b, fnDDdefault);
            DD_Opcodes.Add(0x5c, new Action(() =>
            {
                this.e = this.ixh;
            }));
            DD_Opcodes.Add(0x5d, new Action(() =>
            {
                this.e = this.ixl;
            }));
            DD_Opcodes.Add(0x5e, new Action(() =>
            {
                this.tstates += 11;
                this.e = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x5f, fnDDdefault);
            DD_Opcodes.Add(0x60, new Action(() =>
            {
                this.ixh = this.b;
            }));
            DD_Opcodes.Add(0x61, new Action(() =>
            {
                this.ixh = this.c;
            }));
            DD_Opcodes.Add(0x62, new Action(() =>
            {
                this.ixh = this.d;
            }));
            DD_Opcodes.Add(0x63, new Action(() =>
            {
                this.ixh = this.e;
            }));
            DD_Opcodes.Add(0x64, new Action(() => { }));
            DD_Opcodes.Add(0x65, new Action(() =>
            {
                this.ixh = this.ixl;
            }));
            DD_Opcodes.Add(0x66, new Action(() =>
            {
                this.tstates += 11;
                this.h = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x67, new Action(() =>
            {
                this.ixh = this.a;
            }));
            DD_Opcodes.Add(0x68, new Action(() =>
            {
                this.ixl = this.b;
            }));
            DD_Opcodes.Add(0x69, new Action(() =>
            {
                this.ixl = this.c;
            }));
            DD_Opcodes.Add(0x6a, new Action(() =>
            {
                this.ixl = this.d;
            }));
            DD_Opcodes.Add(0x6b, new Action(() =>
            {
                this.ixl = this.e;
            }));
            DD_Opcodes.Add(0x6c, new Action(() =>
            {
                this.ixl = this.ixh;
            }));
            DD_Opcodes.Add(0x6d, new Action(() => { }));
            DD_Opcodes.Add(0x6e, new Action(() =>
            {
                this.tstates += 11;
                this.l = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x6f, new Action(() =>
            {
                this.ixl = this.a;
            }));
            DD_Opcodes.Add(0x70, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.b);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x71, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.c);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x72, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.d);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x73, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.e);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x74, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.h);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x75, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.l);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x76, fnDDdefault);
            DD_Opcodes.Add(0x77, new Action(() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.a);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x78, fnDDdefault);
            DD_Opcodes.Add(0x79, fnDDdefault);
            DD_Opcodes.Add(0x7a, fnDDdefault);
            DD_Opcodes.Add(0x7b, fnDDdefault);
            DD_Opcodes.Add(0x7c, new Action(() =>
            {
                this.a = this.ixh;
            }));
            DD_Opcodes.Add(0x7d, new Action(() =>
            {
                this.a = this.ixl;
            }));
            DD_Opcodes.Add(0x7e, new Action(() =>
            {
                this.tstates += 11;
                this.a = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            DD_Opcodes.Add(0x7f, fnDDdefault);
            DD_Opcodes.Add(0x80, fnDDdefault);
            DD_Opcodes.Add(0x81, fnDDdefault);
            DD_Opcodes.Add(0x82, fnDDdefault);
            DD_Opcodes.Add(0x83, fnDDdefault);
            DD_Opcodes.Add(0x84, new Action(() =>
            {
                Num addtemp = this.a + this.ixh,
                    lookup = ((this.a & 0x88) >> 3) | ((this.ixh & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = ((addtemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x85, new Action(() =>
            {
                var addtemp = this.a + this.ixl;
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixl & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = ((addtemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x86, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                var addtemp = this.a + bytetemp;
                var lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = ((addtemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x87, fnDDdefault);
            DD_Opcodes.Add(0x88, fnDDdefault);
            DD_Opcodes.Add(0x89, fnDDdefault);
            DD_Opcodes.Add(0x8a, fnDDdefault);
            DD_Opcodes.Add(0x8b, fnDDdefault);
            DD_Opcodes.Add(0x8c, new Action(() =>
            {
                var adctemp = this.a + this.ixh + (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixh & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = ((adctemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x8d, new Action(() =>
            {
                var adctemp = this.a + this.ixl + (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixl & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = ((adctemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x8e, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                var adctemp = this.a + bytetemp + (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = ((adctemp & 0x100) > 0 ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x8f, fnDDdefault);
            DD_Opcodes.Add(0x90, fnDDdefault);
            DD_Opcodes.Add(0x91, fnDDdefault);
            DD_Opcodes.Add(0x92, fnDDdefault);
            DD_Opcodes.Add(0x93, fnDDdefault);
            DD_Opcodes.Add(0x94, new Action(() =>
            {
                var subtemp = this.a - this.ixh;
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixh & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = ((subtemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x95, new Action(() =>
            {
                var subtemp = this.a - this.ixl;
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixl & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = ((subtemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x96, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                var subtemp = this.a - bytetemp;
                var lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = ((subtemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x97, fnDDdefault);
            DD_Opcodes.Add(0x98, fnDDdefault);
            DD_Opcodes.Add(0x99, fnDDdefault);
            DD_Opcodes.Add(0x9a, fnDDdefault);
            DD_Opcodes.Add(0x9b, fnDDdefault);
            DD_Opcodes.Add(0x9c, new Action(() =>
            {
                var sbctemp = this.a - this.ixh - (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixh & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = ((sbctemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x9d, new Action(() =>
            {
                var sbctemp = this.a - this.ixl - (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixl & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = ((sbctemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x9e, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                var sbctemp = this.a - bytetemp - (this.f & 0x01);
                var lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = ((sbctemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            DD_Opcodes.Add(0x9f, fnDDdefault);
            DD_Opcodes.Add(0xa0, fnDDdefault);
            DD_Opcodes.Add(0xa1, fnDDdefault);
            DD_Opcodes.Add(0xa2, fnDDdefault);
            DD_Opcodes.Add(0xa3, fnDDdefault);
            DD_Opcodes.Add(0xa4, new Action(() =>
            {
                this.a &= this.ixh;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xa5, new Action(() =>
            {
                this.a &= this.ixl;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xa6, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a &= bytetemp;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xa7, fnDDdefault);
            DD_Opcodes.Add(0xa8, fnDDdefault);
            DD_Opcodes.Add(0xa9, fnDDdefault);
            DD_Opcodes.Add(0xaa, fnDDdefault);
            DD_Opcodes.Add(0xab, fnDDdefault);
            DD_Opcodes.Add(0xac, new Action(() =>
            {
                this.a ^= this.ixh;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xad, new Action(() =>
            {
                this.a ^= this.ixl;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xae, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a ^= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xaf, fnDDdefault);
            DD_Opcodes.Add(0xb0, fnDDdefault);
            DD_Opcodes.Add(0xb1, fnDDdefault);
            DD_Opcodes.Add(0xb2, fnDDdefault);
            DD_Opcodes.Add(0xb3, fnDDdefault);
            DD_Opcodes.Add(0xb4, new Action(() =>
            {
                this.a |= this.ixh;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xb5, new Action(() =>
            {
                this.a |= this.ixl;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xb6, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a |= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            DD_Opcodes.Add(0xb7, fnDDdefault);
            DD_Opcodes.Add(0xb8, fnDDdefault);
            DD_Opcodes.Add(0xb9, fnDDdefault);
            DD_Opcodes.Add(0xba, fnDDdefault);
            DD_Opcodes.Add(0xbb, fnDDdefault);
            DD_Opcodes.Add(0xbc, new Action(() =>
            {
                var cptemp = this.a - this.ixh;
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixh & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.ixh & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            DD_Opcodes.Add(0xbd, new Action(() =>
            {
                var cptemp = this.a - this.ixl;
                var lookup = ((this.a & 0x88) >> 3) | ((this.ixl & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.ixl & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            DD_Opcodes.Add(0xbe, new Action(() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                var cptemp = this.a - bytetemp;
                var lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (bytetemp & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            DD_Opcodes.Add(0xbf, fnDDdefault);
            DD_Opcodes.Add(0xc0, fnDDdefault);
            DD_Opcodes.Add(0xc1, fnDDdefault);
            DD_Opcodes.Add(0xc2, fnDDdefault);
            DD_Opcodes.Add(0xc3, fnDDdefault);
            DD_Opcodes.Add(0xc4, fnDDdefault);
            DD_Opcodes.Add(0xc5, fnDDdefault);
            DD_Opcodes.Add(0xc6, fnDDdefault);
            DD_Opcodes.Add(0xc7, fnDDdefault);
            DD_Opcodes.Add(0xc8, fnDDdefault);
            DD_Opcodes.Add(0xc9, fnDDdefault);
            DD_Opcodes.Add(0xca, fnDDdefault);
            DD_Opcodes.Add(0xcb, new Action(() =>
            {
                Num tempaddr, opcode3;
                this.tstates += 3;
                tempaddr = (this.ixl | (this.ixh << 8)) + sign_extend(this.memory.readbyte(this.pc++));
                this.pc &= 0xffff;
                this.tstates += 4;
                opcode3 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                DDCB_Opcodes[opcode3].Invoke(tempaddr);
            }));
            DD_Opcodes.Add(0xcc, fnDDdefault);
            DD_Opcodes.Add(0xcd, fnDDdefault);
            DD_Opcodes.Add(0xce, fnDDdefault);
            DD_Opcodes.Add(0xcf, fnDDdefault);
            DD_Opcodes.Add(0xd0, fnDDdefault);
            DD_Opcodes.Add(0xd1, fnDDdefault);
            DD_Opcodes.Add(0xd2, fnDDdefault);
            DD_Opcodes.Add(0xd3, fnDDdefault);
            DD_Opcodes.Add(0xd4, fnDDdefault);
            DD_Opcodes.Add(0xd5, fnDDdefault);
            DD_Opcodes.Add(0xd6, fnDDdefault);
            DD_Opcodes.Add(0xd7, fnDDdefault);
            DD_Opcodes.Add(0xd8, fnDDdefault);
            DD_Opcodes.Add(0xd9, fnDDdefault);
            DD_Opcodes.Add(0xda, fnDDdefault);
            DD_Opcodes.Add(0xdb, fnDDdefault);
            DD_Opcodes.Add(0xdc, fnDDdefault);
            DD_Opcodes.Add(0xdd, fnDDdefault);
            DD_Opcodes.Add(0xde, fnDDdefault);
            DD_Opcodes.Add(0xdf, fnDDdefault);
            DD_Opcodes.Add(0xe0, fnDDdefault);
            DD_Opcodes.Add(0xe1, new Action(() =>
            {
                this.tstates += 3;
                this.ixl = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.ixh = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            DD_Opcodes.Add(0xe2, fnDDdefault);
            DD_Opcodes.Add(0xe3, new Action(() =>
            {
                Num bytetempl = this.memory.readbyte(this.sp),
                    bytetemph = this.memory.readbyte(this.sp + 1);
                this.tstates += 3;
                this.tstates += 4;
                this.tstates += 3;
                this.tstates += 5;
                this.memory.writebyte(this.sp + 1, this.ixh);
                this.memory.writebyte(this.sp, this.ixl);
                this.ixl = bytetempl;
                this.ixh = bytetemph;
            }));
            DD_Opcodes.Add(0xe4, fnDDdefault);
            DD_Opcodes.Add(0xe5, new Action(() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.ixh);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.ixl);
            }));
            DD_Opcodes.Add(0xe6, fnDDdefault);
            DD_Opcodes.Add(0xe7, fnDDdefault);
            DD_Opcodes.Add(0xe8, fnDDdefault);
            DD_Opcodes.Add(0xe9, new Action(() =>
            {
                this.pc = (this.ixl | (this.ixh << 8));
            }));
            DD_Opcodes.Add(0xea, fnDDdefault);
            DD_Opcodes.Add(0xeb, fnDDdefault);
            DD_Opcodes.Add(0xec, fnDDdefault);
            DD_Opcodes.Add(0xed, fnDDdefault);
            DD_Opcodes.Add(0xee, fnDDdefault);
            DD_Opcodes.Add(0xef, fnDDdefault);
            DD_Opcodes.Add(0xf0, fnDDdefault);
            DD_Opcodes.Add(0xf1, fnDDdefault);
            DD_Opcodes.Add(0xf2, fnDDdefault);
            DD_Opcodes.Add(0xf3, fnDDdefault);
            DD_Opcodes.Add(0xf4, fnDDdefault);
            DD_Opcodes.Add(0xf5, fnDDdefault);
            DD_Opcodes.Add(0xf6, fnDDdefault);
            DD_Opcodes.Add(0xf7, fnDDdefault);
            DD_Opcodes.Add(0xf8, fnDDdefault);
            DD_Opcodes.Add(0xf9, new Action(() =>
            {
                this.tstates += 2;
                this.sp = (this.ixl | (this.ixh << 8));
            }));
            DD_Opcodes.Add(0xfa, fnDDdefault);
            DD_Opcodes.Add(0xfb, fnDDdefault);
            DD_Opcodes.Add(0xfc, fnDDdefault);
            DD_Opcodes.Add(0xfd, fnDDdefault);
            DD_Opcodes.Add(0xfe, fnDDdefault);
            DD_Opcodes.Add(0xff, fnDDdefault);

            #endregion

            //    //--------------------------------------------;
            var ED_Opcodes = new Dictionary<Num, Action>();
            #region ED_Opcodes
            var fnED0x40 = new Action(() =>
            {
                this.tstates += 4;
                this.b = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.b];
            });

            var fnED0x7c = new Action(() =>
            {
                var bytetemp = this.a;
                this.a = 0;
                Num subtemp = this.a - bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = ((subtemp & 0x100) > 0 ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            });

            var fnED0x7d = new Action(() =>
            {
                this.iff1 = this.iff2;
                this.tstates += 3;
                var lowbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                var highbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                (this.pc) = lowbyte | (highbyte << 8);
            });
            var fnED0x6e = new Action(() =>
            {
                this.im = 0;
            });
            var fnED0x47 = new Action(() =>
            {
                this.tstates += 1;
                this.i = this.a;
            });
            var fnED0x76 = new Action(() =>
            {
                this.im = 1;
            });
            var fnED0x7e = new Action(() =>
            {
                this.im = 2;
            });
            //--------------------------------------------;

            ED_Opcodes.Add(0x00, fnDoNuffink);
            ED_Opcodes.Add(0x01, fnDoNuffink);
            ED_Opcodes.Add(0x02, fnDoNuffink);
            ED_Opcodes.Add(0x03, fnDoNuffink);
            ED_Opcodes.Add(0x04, fnDoNuffink);
            ED_Opcodes.Add(0x05, fnDoNuffink);
            ED_Opcodes.Add(0x06, fnDoNuffink);
            ED_Opcodes.Add(0x07, fnDoNuffink);
            ED_Opcodes.Add(0x08, fnDoNuffink);
            ED_Opcodes.Add(0x09, fnDoNuffink);
            ED_Opcodes.Add(0x0a, fnDoNuffink);
            ED_Opcodes.Add(0x0b, fnDoNuffink);
            ED_Opcodes.Add(0x0c, fnDoNuffink);
            ED_Opcodes.Add(0x0d, fnDoNuffink);
            ED_Opcodes.Add(0x0e, fnDoNuffink);
            ED_Opcodes.Add(0x0f, fnDoNuffink);
            ED_Opcodes.Add(0x10, fnDoNuffink);
            ED_Opcodes.Add(0x11, fnDoNuffink);
            ED_Opcodes.Add(0x12, fnDoNuffink);
            ED_Opcodes.Add(0x13, fnDoNuffink);
            ED_Opcodes.Add(0x14, fnDoNuffink);
            ED_Opcodes.Add(0x15, fnDoNuffink);
            ED_Opcodes.Add(0x16, fnDoNuffink);
            ED_Opcodes.Add(0x17, fnDoNuffink);
            ED_Opcodes.Add(0x18, fnDoNuffink);
            ED_Opcodes.Add(0x19, fnDoNuffink);
            ED_Opcodes.Add(0x1a, fnDoNuffink);
            ED_Opcodes.Add(0x1b, fnDoNuffink);
            ED_Opcodes.Add(0x1c, fnDoNuffink);
            ED_Opcodes.Add(0x1d, fnDoNuffink);
            ED_Opcodes.Add(0x1e, fnDoNuffink);
            ED_Opcodes.Add(0x1f, fnDoNuffink);
            ED_Opcodes.Add(0x20, fnDoNuffink);
            ED_Opcodes.Add(0x21, fnDoNuffink);
            ED_Opcodes.Add(0x22, fnDoNuffink);
            ED_Opcodes.Add(0x23, fnDoNuffink);
            ED_Opcodes.Add(0x24, fnDoNuffink);
            ED_Opcodes.Add(0x25, fnDoNuffink);
            ED_Opcodes.Add(0x26, fnDoNuffink);
            ED_Opcodes.Add(0x27, fnDoNuffink);
            ED_Opcodes.Add(0x28, fnDoNuffink);
            ED_Opcodes.Add(0x29, fnDoNuffink);
            ED_Opcodes.Add(0x2a, fnDoNuffink);
            ED_Opcodes.Add(0x2b, fnDoNuffink);
            ED_Opcodes.Add(0x2c, fnDoNuffink);
            ED_Opcodes.Add(0x2d, fnDoNuffink);
            ED_Opcodes.Add(0x2e, fnDoNuffink);
            ED_Opcodes.Add(0x2f, fnDoNuffink);
            ED_Opcodes.Add(0x30, fnDoNuffink);
            ED_Opcodes.Add(0x31, fnDoNuffink);
            ED_Opcodes.Add(0x32, fnDoNuffink);
            ED_Opcodes.Add(0x33, fnDoNuffink);
            ED_Opcodes.Add(0x34, fnDoNuffink);
            ED_Opcodes.Add(0x35, fnDoNuffink);
            ED_Opcodes.Add(0x36, fnDoNuffink);
            ED_Opcodes.Add(0x37, fnDoNuffink);
            ED_Opcodes.Add(0x38, fnDoNuffink);
            ED_Opcodes.Add(0x39, fnDoNuffink);
            ED_Opcodes.Add(0x3a, fnDoNuffink);
            ED_Opcodes.Add(0x3b, fnDoNuffink);
            ED_Opcodes.Add(0x3c, fnDoNuffink);
            ED_Opcodes.Add(0x3d, fnDoNuffink);
            ED_Opcodes.Add(0x3e, fnDoNuffink);
            ED_Opcodes.Add(0x3f, fnDoNuffink);
            ED_Opcodes.Add(0x40, (() =>
            {
                this.tstates += 4;
                this.b = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.b];
            }));
            ED_Opcodes.Add(0x41, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.b);
            }));
            ED_Opcodes.Add(0x42, (() =>
            {
                this.tstates += 7;
                var sub16temp = (this.l | (this.h << 8)) - ((this.c | (this.b << 8))) - (this.f & 0x01);
                var lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.c | (this.b << 8))) & 0x8800) >> 10) | ((sub16temp & 0x8800) >> 9);
                this.h = (sub16temp >> 8) & 0xff;
                this.l = sub16temp & 0xff;
                this.f = ((sub16temp & 0x10000) > 0 ? 0x01 : 0) | 0x02 | lookupTables.overflow_sub[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_sub[lookup & 0x07] | (((this.l) > 0 | ((this.h << 8) > 0)) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x43, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.c);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.b);
            }));
            ED_Opcodes.Add(0x44, fnED0x7c);
            ED_Opcodes.Add(0x45, fnED0x7d);
            ED_Opcodes.Add(0x46, fnED0x6e);
            ED_Opcodes.Add(0x47, (() =>
            {
                this.tstates += 1;
                this.i = this.a;
            }));
            ED_Opcodes.Add(0x48, (() =>
            {
                this.tstates += 4;
                this.c = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.c];
            }));
            ED_Opcodes.Add(0x49, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.c);
            }));
            ED_Opcodes.Add(0x4a, (() =>
            {
                this.tstates += 7;
                Num add16temp = (this.l | (this.h << 8)) + ((this.c | (this.b << 8))) + (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.c | (this.b << 8))) & 0x8800) >> 10) | ((add16temp & 0x8800) >> 9);
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = ((add16temp & 0x10000) > 0 ? 0x01 : 0) | lookupTables.overflow_add[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_add[lookup & 0x07] | (((this.l | (this.h << 8)) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x4b, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.c = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.b = this.memory.readbyte(ldtemp);
            }));
            ED_Opcodes.Add(0x4c, fnED0x7c);
            ED_Opcodes.Add(0x4d, fnED0x7d);
            ED_Opcodes.Add(0x4e, fnED0x6e);
            ED_Opcodes.Add(0x4f, (() =>
            {
                this.tstates += 1;
                this.r = this.r7 = this.a;
            }));
            ED_Opcodes.Add(0x50, (() =>
            {
                this.tstates += 4;
                this.d = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.d];
            }));
            ED_Opcodes.Add(0x51, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.d);
            }));
            ED_Opcodes.Add(0x52, (() =>
            {
                this.tstates += 7;
                Num sub16temp = (this.l | (this.h << 8)) - ((this.e | (this.d << 8))) - (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.e | (this.d << 8))) & 0x8800) >> 10) | ((sub16temp & 0x8800) >> 9);
                this.h = (sub16temp >> 8) & 0xff;
                this.l = sub16temp & 0xff;
                this.f = (((sub16temp & 0x10000) > 0) ? 0x01 : 0) | 0x02 | lookupTables.overflow_sub[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_sub[lookup & 0x07] | ((this.l > 0 | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x53, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.e);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.d);
            }));
            ED_Opcodes.Add(0x54, fnED0x7c);
            ED_Opcodes.Add(0x55, fnED0x7d);
            ED_Opcodes.Add(0x56, fnED0x76);
            ED_Opcodes.Add(0x57, (() =>
            {
                this.tstates += 1;
                this.a = this.i;
                this.f = (this.f & 0x01) | lookupTables.sz53[this.a] | ((this.iff2) > 0 ? 0x04 : 0);
            }));
            ED_Opcodes.Add(0x58, (() =>
            {
                this.tstates += 4;
                this.e = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.e];
            }));
            ED_Opcodes.Add(0x59, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.e);
            }));
            ED_Opcodes.Add(0x5a, (() =>
            {
                this.tstates += 7;
                var add16temp = (this.l | (this.h << 8)) + ((this.e | (this.d << 8))) + (this.f & 0x01);
                var lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.e | (this.d << 8))) & 0x8800) >> 10) | ((add16temp & 0x8800) >> 9);
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = ((add16temp & 0x10000) > 0 ? 0x01 : 0) | lookupTables.overflow_add[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_add[lookup & 0x07] | (((this.l > 0) | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x5b, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.e = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.d = this.memory.readbyte(ldtemp);
            }));
            ED_Opcodes.Add(0x5c, fnED0x7c);
            ED_Opcodes.Add(0x5d, fnED0x7d);
            ED_Opcodes.Add(0x5e, fnED0x7e);
            ED_Opcodes.Add(0x5f, (() =>
            {
                this.tstates += 1;
                this.a = (this.r & 0x7f) | (this.r7 & 0x80);
                this.f = (this.f & 0x01) | lookupTables.sz53[this.a] | (this.iff2 > 0 ? 0x04 : 0);
            }));
            ED_Opcodes.Add(0x60, (() =>
            {
                this.tstates += 4;
                this.h = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.h];
            }));
            ED_Opcodes.Add(0x61, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.h);
            }));
            ED_Opcodes.Add(0x62, (() =>
            {
                this.tstates += 7;
                Num sub16temp = (this.l | (this.h << 8)) - ((this.l | (this.h << 8))) - (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.l | (this.h << 8))) & 0x8800) >> 10) | ((sub16temp & 0x8800) >> 9);
                this.h = (sub16temp >> 8) & 0xff;
                this.l = sub16temp & 0xff;
                this.f = ((sub16temp & 0x10000) > 0 ? 0x01 : 0) | 0x02 | lookupTables.overflow_sub[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_sub[lookup & 0x07] | ((this.l > 0 | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x63, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.l);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.h);
            }));
            ED_Opcodes.Add(0x64, fnED0x7c);
            ED_Opcodes.Add(0x65, fnED0x7d);
            ED_Opcodes.Add(0x66, fnED0x6e);
            ED_Opcodes.Add(0x67, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 10;
                this.memory.writebyte((this.l | (this.h << 8)), ((this.a & 0x0f) << 4) | (bytetemp >> 4));
                this.a = (this.a & 0xf0) | (bytetemp & 0x0f);
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.a];
            }));
            ED_Opcodes.Add(0x68, (() =>
            {
                this.tstates += 4;
                this.l = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.l];
            }));
            ED_Opcodes.Add(0x69, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.l);
            }));
            ED_Opcodes.Add(0x6a, (() =>
            {
                this.tstates += 7;
                Num add16temp = (this.l | (this.h << 8)) + ((this.l | (this.h << 8))) + (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | ((((this.l | (this.h << 8))) & 0x8800) >> 10) | ((add16temp & 0x8800) >> 9);
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = ((add16temp & 0x10000) > 0 ? 0x01 : 0) | lookupTables.overflow_add[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_add[lookup & 0x07] | ((this.l > 0 | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x6b, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.l = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.h = this.memory.readbyte(ldtemp);
            }));
            ED_Opcodes.Add(0x6c, fnED0x7c);
            ED_Opcodes.Add(0x6d, fnED0x7d);
            ED_Opcodes.Add(0x6e, (() =>
            {
                this.im = 0;
            }));
            ED_Opcodes.Add(0x6f, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 10;
                this.memory.writebyte((this.l | (this.h << 8)), ((bytetemp & 0x0f) << 4) | (this.a & 0x0f));
                this.a = (this.a & 0xf0) | (bytetemp >> 4);
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.a];
            }));
            ED_Opcodes.Add(0x70, (() =>
            {
                this.tstates += 4;
                var bytetemp = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[bytetemp];
            }));
            ED_Opcodes.Add(0x71, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), 0);
            }));
            ED_Opcodes.Add(0x72, (() =>
            {
                this.tstates += 7;
                Num sub16temp = (this.l | (this.h << 8)) - (this.sp) - (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | (((this.sp) & 0x8800) >> 10) | ((sub16temp & 0x8800) >> 9);
                this.h = (sub16temp >> 8) & 0xff;
                this.l = sub16temp & 0xff;
                this.f = ((sub16temp & 0x10000) > 0 ? 0x01 : 0) | 0x02 | lookupTables.overflow_sub[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_sub[lookup & 0x07] | ((this.l > 0 | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x73, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, ((this.sp & 0xff)));
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, ((this.sp >> 8)));
            }));
            ED_Opcodes.Add(0x74, fnED0x7c);
            ED_Opcodes.Add(0x75, fnED0x7d);
            ED_Opcodes.Add(0x76, (() =>
            {
                this.im = 1;
            }));
            ED_Opcodes.Add(0x77, fnDoNuffink);
            ED_Opcodes.Add(0x78, (() =>
            {
                this.tstates += 4;
                this.a = this.port.readport(((this.c | (this.b << 8))));
                this.f = (this.f & 0x01) | lookupTables.sz53p[this.a];
            }));
            ED_Opcodes.Add(0x79, (() =>
            {
                this.tstates += 4;
                this.port.writeport((this.c | (this.b << 8)), this.a);
            }));
            ED_Opcodes.Add(0x7a, (() =>
            {
                this.tstates += 7;
                Num add16temp = (this.l | (this.h << 8)) + (this.sp) + (this.f & 0x01),
                    lookup = (((this.l | (this.h << 8)) & 0x8800) >> 11) | (((this.sp) & 0x8800) >> 10) | ((add16temp & 0x8800) >> 9);
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = ((add16temp & 0x10000) > 0 ? 0x01 : 0) | lookupTables.overflow_add[lookup >> 4] | (this.h & (0x08 | 0x20 | 0x80)) | lookupTables.halfcarry_add[lookup & 0x07] | ((this.l > 0 | (this.h << 8) > 0) ? 0 : 0x40);
            }));
            ED_Opcodes.Add(0x7b, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                var regl = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                var regh = this.memory.readbyte(ldtemp);
                this.sp = regl | (regh << 8);
            }));
            ED_Opcodes.Add(0x7c, fnED0x7c);
            ED_Opcodes.Add(0x7d, (() =>
            {
                this.iff1 = this.iff2;
                this.tstates += 3;
                var lowbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                var highbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                (this.pc) = lowbyte | (highbyte << 8);
            }));
            ED_Opcodes.Add(0x7e, fnED0x7e);
            ED_Opcodes.Add(0x7f, fnDoNuffink);
            ED_Opcodes.Add(0x80, fnDoNuffink);
            ED_Opcodes.Add(0x81, fnDoNuffink);
            ED_Opcodes.Add(0x82, fnDoNuffink);
            ED_Opcodes.Add(0x83, fnDoNuffink);
            ED_Opcodes.Add(0x84, fnDoNuffink);
            ED_Opcodes.Add(0x85, fnDoNuffink);
            ED_Opcodes.Add(0x86, fnDoNuffink);
            ED_Opcodes.Add(0x87, fnDoNuffink);
            ED_Opcodes.Add(0x88, fnDoNuffink);
            ED_Opcodes.Add(0x89, fnDoNuffink);
            ED_Opcodes.Add(0x8a, fnDoNuffink);
            ED_Opcodes.Add(0x8b, fnDoNuffink);
            ED_Opcodes.Add(0x8c, fnDoNuffink);
            ED_Opcodes.Add(0x8d, fnDoNuffink);
            ED_Opcodes.Add(0x8e, fnDoNuffink);
            ED_Opcodes.Add(0x8f, fnDoNuffink);
            ED_Opcodes.Add(0x90, fnDoNuffink);
            ED_Opcodes.Add(0x91, fnDoNuffink);
            ED_Opcodes.Add(0x92, fnDoNuffink);
            ED_Opcodes.Add(0x93, fnDoNuffink);
            ED_Opcodes.Add(0x94, fnDoNuffink);
            ED_Opcodes.Add(0x95, fnDoNuffink);
            ED_Opcodes.Add(0x96, fnDoNuffink);
            ED_Opcodes.Add(0x97, fnDoNuffink);
            ED_Opcodes.Add(0x98, fnDoNuffink);
            ED_Opcodes.Add(0x99, fnDoNuffink);
            ED_Opcodes.Add(0x9a, fnDoNuffink);
            ED_Opcodes.Add(0x9b, fnDoNuffink);
            ED_Opcodes.Add(0x9c, fnDoNuffink);
            ED_Opcodes.Add(0x9d, fnDoNuffink);
            ED_Opcodes.Add(0x9e, fnDoNuffink);
            ED_Opcodes.Add(0x9f, fnDoNuffink);
            ED_Opcodes.Add(0xa0, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 8;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.memory.writebyte((this.e | (this.d << 8)), bytetemp);
                var detemp = ((this.e | (this.d << 8)) + 1) & 0xffff;
                this.d = detemp >> 8;
                this.e = detemp & 0xff;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                bytetemp = (bytetemp + this.a) & 0xff;
                this.f = (this.f & (0x01 | 0x40 | 0x80)) | ((this.c > 0 | (this.b << 8) > 0) ? 0x04 : 0) | (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
            }));
            ED_Opcodes.Add(0xa1, (() =>
            {
                Num value = this.memory.readbyte((this.l | (this.h << 8))),
                    bytetemp = (this.a - value) & 0xff,
                    lookup = ((this.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1);
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.f = (this.f & 0x01) | ((this.c > 0 | (this.b << 8) > 0) ? (0x04 | 0x02) : 0x02) | lookupTables.halfcarry_sub[lookup] | (bytetemp > 0 ? 0 : 0x40) | (bytetemp & 0x80);
                if ((this.f & 0x10) > 0) bytetemp--;
                this.f |= (bytetemp & 0x08) | (((bytetemp & 0x02) > 0) ? 0x20 : 0);
            }));
            ED_Opcodes.Add(0xa2, (() =>
            {
                var initemp = this.port.readport((this.c | (this.b << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.l | (this.h << 8)), initemp);
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.f = ((initemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
            }));
            ED_Opcodes.Add(0xa3, (() =>
            {
                var outitemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.b = (this.b - 1) & 0xff;
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.port.writeport((this.c | (this.b << 8)), outitemp);
                this.f = ((outitemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
            }));
            ED_Opcodes.Add(0xa4, fnDoNuffink);
            ED_Opcodes.Add(0xa5, fnDoNuffink);
            ED_Opcodes.Add(0xa6, fnDoNuffink);
            ED_Opcodes.Add(0xa7, fnDoNuffink);
            ED_Opcodes.Add(0xa8, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 8;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.memory.writebyte((this.e | (this.d << 8)), bytetemp);
                var detemp = ((this.e | (this.d << 8)) - 1) & 0xffff;
                this.d = detemp >> 8;
                this.e = detemp & 0xff;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                bytetemp = (bytetemp + this.a) & 0xff;
                this.f = (this.f & (0x01 | 0x40 | 0x80)) | ((this.c > 0 | (this.b << 8) > 0) ? 0x04 : 0) | (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
            }));
            ED_Opcodes.Add(0xa9, (() =>
            {
                Num value = this.memory.readbyte((this.l | (this.h << 8))),
                    bytetemp = (this.a - value) & 0xff,
                    lookup = ((this.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1);
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.f = (this.f & 0x01) | ((this.c > 0 | (this.b << 8) > 0) ? (0x04 | 0x02) : 0x02) | lookupTables.halfcarry_sub[lookup] | (bytetemp > 0 ? 0 : 0x40) | (bytetemp & 0x80);
                if ((this.f & 0x10) > 0) bytetemp--;
                this.f |= (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
            }));
            ED_Opcodes.Add(0xaa, (() =>
            {
                var initemp = this.port.readport((this.c | (this.b << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.l | (this.h << 8)), initemp);
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.f = ((initemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
            }));
            ED_Opcodes.Add(0xab, (() =>
            {
                var outitemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.b = (this.b - 1) & 0xff;
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.port.writeport((this.c | (this.b << 8)), outitemp);
                this.f = ((outitemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
            }));
            ED_Opcodes.Add(0xac, fnDoNuffink);
            ED_Opcodes.Add(0xad, fnDoNuffink);
            ED_Opcodes.Add(0xae, fnDoNuffink);
            ED_Opcodes.Add(0xaf, fnDoNuffink);
            ED_Opcodes.Add(0xb0, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.e | (this.d << 8)), bytetemp);
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var detemp = ((this.e | (this.d << 8)) + 1) & 0xffff;
                this.d = detemp >> 8;
                this.e = detemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                bytetemp = (bytetemp + this.a) & 0xff;
                this.f = (this.f & (0x01 | 0x40 | 0x80)) | ((this.c > 0 | (this.b << 8) > 0) ? 0x04 : 0) | (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
                if ((this.c > 0 | (this.b << 8) > 0))
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xb1, (() =>
            {
                Num value = this.memory.readbyte((this.l | (this.h << 8))),
                    bytetemp = (this.a - value) & 0xff,
                    lookup = ((this.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1);
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.f = (this.f & 0x01) | ((this.c > 0 | (this.b << 8) > 0) ? (0x04 | 0x02) : 0x02) | lookupTables.halfcarry_sub[lookup] | (bytetemp > 0 ? 0 : 0x40) | (bytetemp & 0x80);
                if ((this.f & 0x10) > 0) bytetemp--;
                this.f |= (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
                if ((this.f & (0x04 | 0x40)) == 0x04)
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xb2, (() =>
            {
                var initemp = this.port.readport((this.c | (this.b << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.l | (this.h << 8)), initemp);
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.f = ((initemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
                if (this.b > 0)
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xb3, (() =>
            {
                var outitemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 5;
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.port.writeport((this.c | (this.b << 8)), outitemp);
                this.f = ((outitemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
                if (this.b > 0)
                {
                    this.tstates += 8;
                    this.pc -= 2;
                }
                else
                {
                    this.tstates += 3;
                }
            }));
            ED_Opcodes.Add(0xb4, fnDoNuffink);
            ED_Opcodes.Add(0xb5, fnDoNuffink);
            ED_Opcodes.Add(0xb6, fnDoNuffink);
            ED_Opcodes.Add(0xb7, fnDoNuffink);
            ED_Opcodes.Add(0xb8, (() =>
            {
                var bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.e | (this.d << 8)), bytetemp);
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var detemp = ((this.e | (this.d << 8)) - 1) & 0xffff;
                this.d = detemp >> 8;
                this.e = detemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                bytetemp = (bytetemp + this.a) & 0xff;
                this.f = (this.f & (0x01 | 0x40 | 0x80)) | ((this.c > 0 | (this.b << 8) > 0) ? 0x04 : 0) | (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
                if ((this.c > 0 | (this.b << 8) > 0))
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xb9, (() =>
            {
                Num value = this.memory.readbyte((this.l | (this.h << 8))),
                    bytetemp = (this.a - value) & 0xff,
                    lookup = ((this.a & 0x08) >> 3) | (((value) & 0x08) >> 2) | ((bytetemp & 0x08) >> 1);
                this.tstates += 8;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                var bctemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = bctemp >> 8;
                this.c = bctemp & 0xff;
                this.f = (((this.f & 0x01) > 0) | (this.c > 0 | (this.b << 8) > 0) ? (0x04 | 0x02) : 0x02) | lookupTables.halfcarry_sub[lookup] | (bytetemp > 0 ? 0 : 0x40) | (bytetemp & 0x80);
                if ((this.f & 0x10) > 0) bytetemp--;
                this.f |= (bytetemp & 0x08) | ((bytetemp & 0x02) > 0 ? 0x20 : 0);
                if ((this.f & (0x04 | 0x40)) == 0x04)
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xba, (() =>
            {
                var initemp = this.port.readport((this.c | (this.b << 8)));
                this.tstates += 8;
                this.memory.writebyte((this.l | (this.h << 8)), initemp);
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.f = ((initemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
                if (this.b > 0)
                {
                    this.tstates += 5;
                    this.pc -= 2;
                }
            }));
            ED_Opcodes.Add(0xbb, (() =>
            {
                var outitemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.tstates += 5;
                this.b = (this.b - 1) & 0xff;
                var hltemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = hltemp >> 8;
                this.l = hltemp & 0xff;
                this.port.writeport((this.c | (this.b << 8)), outitemp);
                this.f = ((outitemp & 0x80) > 0 ? 0x02 : 0) | lookupTables.sz53[this.b];
                if (this.b > 0)
                {
                    this.tstates += 8;
                    this.pc -= 2;
                }
                else
                {
                    this.tstates += 3;
                }
            }));
            ED_Opcodes.Add(0xbc, fnDoNuffink);
            ED_Opcodes.Add(0xbd, fnDoNuffink);
            ED_Opcodes.Add(0xbe, fnDoNuffink);
            ED_Opcodes.Add(0xbf, fnDoNuffink);
            ED_Opcodes.Add(0xc0, fnDoNuffink);
            ED_Opcodes.Add(0xc1, fnDoNuffink);
            ED_Opcodes.Add(0xc2, fnDoNuffink);
            ED_Opcodes.Add(0xc3, fnDoNuffink);
            ED_Opcodes.Add(0xc4, fnDoNuffink);
            ED_Opcodes.Add(0xc5, fnDoNuffink);
            ED_Opcodes.Add(0xc6, fnDoNuffink);
            ED_Opcodes.Add(0xc7, fnDoNuffink);
            ED_Opcodes.Add(0xc8, fnDoNuffink);
            ED_Opcodes.Add(0xc9, fnDoNuffink);
            ED_Opcodes.Add(0xca, fnDoNuffink);
            ED_Opcodes.Add(0xcb, fnDoNuffink);
            ED_Opcodes.Add(0xcc, fnDoNuffink);
            ED_Opcodes.Add(0xcd, fnDoNuffink);
            ED_Opcodes.Add(0xce, fnDoNuffink);
            ED_Opcodes.Add(0xcf, fnDoNuffink);
            ED_Opcodes.Add(0xd0, fnDoNuffink);
            ED_Opcodes.Add(0xd1, fnDoNuffink);
            ED_Opcodes.Add(0xd2, fnDoNuffink);
            ED_Opcodes.Add(0xd3, fnDoNuffink);
            ED_Opcodes.Add(0xd4, fnDoNuffink);
            ED_Opcodes.Add(0xd5, fnDoNuffink);
            ED_Opcodes.Add(0xd6, fnDoNuffink);
            ED_Opcodes.Add(0xd7, fnDoNuffink);
            ED_Opcodes.Add(0xd8, fnDoNuffink);
            ED_Opcodes.Add(0xd9, fnDoNuffink);
            ED_Opcodes.Add(0xda, fnDoNuffink);
            ED_Opcodes.Add(0xdb, fnDoNuffink);
            ED_Opcodes.Add(0xdc, fnDoNuffink);
            ED_Opcodes.Add(0xdd, fnDoNuffink);
            ED_Opcodes.Add(0xde, fnDoNuffink);
            ED_Opcodes.Add(0xdf, fnDoNuffink);
            ED_Opcodes.Add(0xe0, fnDoNuffink);
            ED_Opcodes.Add(0xe1, fnDoNuffink);
            ED_Opcodes.Add(0xe2, fnDoNuffink);
            ED_Opcodes.Add(0xe3, fnDoNuffink);
            ED_Opcodes.Add(0xe4, fnDoNuffink);
            ED_Opcodes.Add(0xe5, fnDoNuffink);
            ED_Opcodes.Add(0xe6, fnDoNuffink);
            ED_Opcodes.Add(0xe7, fnDoNuffink);
            ED_Opcodes.Add(0xe8, fnDoNuffink);
            ED_Opcodes.Add(0xe9, fnDoNuffink);
            ED_Opcodes.Add(0xea, fnDoNuffink);
            ED_Opcodes.Add(0xeb, fnDoNuffink);
            ED_Opcodes.Add(0xec, fnDoNuffink);
            ED_Opcodes.Add(0xed, fnDoNuffink);
            ED_Opcodes.Add(0xee, fnDoNuffink);
            ED_Opcodes.Add(0xef, fnDoNuffink);
            ED_Opcodes.Add(0xf0, fnDoNuffink);
            ED_Opcodes.Add(0xf1, fnDoNuffink);
            ED_Opcodes.Add(0xf2, fnDoNuffink);
            ED_Opcodes.Add(0xf3, fnDoNuffink);
            ED_Opcodes.Add(0xf4, fnDoNuffink);
            ED_Opcodes.Add(0xf5, fnDoNuffink);
            ED_Opcodes.Add(0xf6, fnDoNuffink);
            ED_Opcodes.Add(0xf7, fnDoNuffink);
            ED_Opcodes.Add(0xf8, fnDoNuffink);
            ED_Opcodes.Add(0xf9, fnDoNuffink);
            ED_Opcodes.Add(0xfa, fnDoNuffink);
            ED_Opcodes.Add(0xfb, fnDoNuffink);
            ED_Opcodes.Add(0xfc, fnDoNuffink);
            ED_Opcodes.Add(0xfd, fnDoNuffink);
            ED_Opcodes.Add(0xfe, fnDoNuffink);
            ED_Opcodes.Add(0xff, fnDoNuffink);

            #endregion

            //    ////--------------------------------------------;	
            var FDCDOpcodes = new Dictionary<Num, Action<Num>>();
            #region FDCD Opcodes
            //    //        //--------------------------------------------;
            var fnFDCD0x47 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 0)) > 0)) this.f |= 0x04 | 0x40;
                if (0 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x4f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 1)) > 0)) this.f |= 0x04 | 0x40;
                if (1 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x57 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 2)) > 0)) this.f |= 0x04 | 0x40;
                if (2 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x5f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 3)) > 0)) this.f |= 0x04 | 0x40;
                if (3 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x67 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 4)) > 0)) this.f |= 0x04 | 0x40;
                if (4 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x6f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 5)) > 0)) this.f |= 0x04 | 0x40;
                if (5 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x77 = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 6)) > 0)) this.f |= 0x04 | 0x40;
                if (6 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            var fnFDCD0x7f = new Action<Num>(tempaddr =>
            {
                this.tstates += 5;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = (this.f & 0x01) | 0x10 | ((tempaddr >> 8) & (0x08 | 0x20));
                if (!((bytetemp & (0x01 << 7)) > 0)) this.f |= 0x04 | 0x40;
                if (7 == 7 && (bytetemp & 0x80) > 0) this.f |= 0x80;
            });
            //--------------------------------------------;
            FDCDOpcodes.Add(0x00, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.b = ((this.b & 0x7f) << 1) | (this.b >> 7);
                this.f = (this.b & 0x01) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x01, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.c = ((this.c & 0x7f) << 1) | (this.c >> 7);
                this.f = (this.c & 0x01) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x02, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.d = ((this.d & 0x7f) << 1) | (this.d >> 7);
                this.f = (this.d & 0x01) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x03, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.e = ((this.e & 0x7f) << 1) | (this.e >> 7);
                this.f = (this.e & 0x01) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x04, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.h = ((this.h & 0x7f) << 1) | (this.h >> 7);
                this.f = (this.h & 0x01) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x05, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.l = ((this.l & 0x7f) << 1) | (this.l >> 7);
                this.f = (this.l & 0x01) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x06, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                bytetemp = ((bytetemp & 0x7f) << 1) | (bytetemp >> 7);
                this.f = (bytetemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x07, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.a = ((this.a & 0x7f) << 1) | (this.a >> 7);
                this.f = (this.a & 0x01) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x08, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b = (this.b >> 1) | ((this.b & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x09, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c = (this.c >> 1) | ((this.c & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x0a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d = (this.d >> 1) | ((this.d & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x0b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e = (this.e >> 1) | ((this.e & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x0c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h = (this.h >> 1) | ((this.h & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x0d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l = (this.l >> 1) | ((this.l & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x0e, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp >> 1) | ((bytetemp & 0x01) << 7);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x0f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a = (this.a >> 1) | ((this.a & 0x01) << 7);
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x10, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                var rltemp = this.b;
                this.b = ((this.b & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x11, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                var rltemp = this.c;
                this.c = ((this.c & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x12, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                var rltemp = this.d;
                this.d = ((this.d & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x13, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                var rltemp = this.e;
                this.e = ((this.e & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x14, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                var rltemp = this.h;
                this.h = ((this.h & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x15, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                var rltemp = this.l;
                this.l = ((this.l & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x16, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                var rltemp = bytetemp;
                bytetemp = ((bytetemp & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x17, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                var rltemp = this.a;
                this.a = ((this.a & 0x7f) << 1) | (this.f & 0x01);
                this.f = (rltemp >> 7) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x18, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                var rrtemp = this.b;
                this.b = (this.b >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x19, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                var rrtemp = this.c;
                this.c = (this.c >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x1a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                var rrtemp = this.d;
                this.d = (this.d >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x1b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                var rrtemp = this.e;
                this.e = (this.e >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x1c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                var rrtemp = this.h;
                this.h = (this.h >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x1d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                var rrtemp = this.l;
                this.l = (this.l >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x1e, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                var rrtemp = bytetemp;
                bytetemp = (bytetemp >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x1f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                var rrtemp = this.a;
                this.a = (this.a >> 1) | ((this.f & 0x01) << 7);
                this.f = (rrtemp & 0x01) | lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x20, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b >> 7;
                this.b <<= 1;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x21, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c >> 7;
                this.c <<= 1;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x22, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d >> 7;
                this.d <<= 1;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x23, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e >> 7;
                this.e <<= 1;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x24, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h >> 7;
                this.h <<= 1;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x25, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l >> 7;
                this.l <<= 1;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x26, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp >> 7;
                bytetemp <<= 1;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x27, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a >> 7;
                this.a <<= 1;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x28, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b = (this.b & 0x80) | (this.b >> 1);
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x29, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c = (this.c & 0x80) | (this.c >> 1);
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x2a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d = (this.d & 0x80) | (this.d >> 1);
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x2b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e = (this.e & 0x80) | (this.e >> 1);
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x2c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h = (this.h & 0x80) | (this.h >> 1);
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x2d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l = (this.l & 0x80) | (this.l >> 1);
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x2e, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp = (bytetemp & 0x80) | (bytetemp >> 1);
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x2f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a = (this.a & 0x80) | (this.a >> 1);
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x30, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b >> 7;
                this.b = (this.b << 1) | 0x01;
                this.b &= 0xff;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x31, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c >> 7;
                this.c = (this.c << 1) | 0x01;
                this.c &= 0xff;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x32, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d >> 7;
                this.d = (this.d << 1) | 0x01;
                this.d &= 0xff;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x33, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e >> 7;
                this.e = (this.e << 1) | 0x01;
                this.e &= 0xff;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x34, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h >> 7;
                this.h = (this.h << 1) | 0x01;
                this.h &= 0xff;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x35, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l >> 7;
                this.l = (this.l << 1) | 0x01;
                this.l &= 0xff;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x36, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp >> 7;
                bytetemp = (bytetemp << 1) | 0x01;
                bytetemp &= 0xff;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x37, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a >> 7;
                this.a = (this.a << 1) | 0x01;
                this.a &= 0xff;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x38, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr);
                this.f = this.b & 0x01;
                this.b >>= 1;
                this.f |= lookupTables.sz53p[this.b];
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x39, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr);
                this.f = this.c & 0x01;
                this.c >>= 1;
                this.f |= lookupTables.sz53p[this.c];
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x3a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr);
                this.f = this.d & 0x01;
                this.d >>= 1;
                this.f |= lookupTables.sz53p[this.d];
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x3b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr);
                this.f = this.e & 0x01;
                this.e >>= 1;
                this.f |= lookupTables.sz53p[this.e];
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x3c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr);
                this.f = this.h & 0x01;
                this.h >>= 1;
                this.f |= lookupTables.sz53p[this.h];
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x3d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr);
                this.f = this.l & 0x01;
                this.l >>= 1;
                this.f |= lookupTables.sz53p[this.l];
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x3e, (tempaddr =>
            {
                this.tstates += 8;
                var bytetemp = this.memory.readbyte(tempaddr);
                this.f = bytetemp & 0x01;
                bytetemp >>= 1;
                this.f |= lookupTables.sz53p[bytetemp];
                this.memory.writebyte(tempaddr, bytetemp);
            }));
            FDCDOpcodes.Add(0x3f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr);
                this.f = this.a & 0x01;
                this.a >>= 1;
                this.f |= lookupTables.sz53p[this.a];
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x47, fnFDCD0x47);
            FDCDOpcodes.Add(0x40, fnFDCD0x47);
            FDCDOpcodes.Add(0x41, fnFDCD0x47);
            FDCDOpcodes.Add(0x42, fnFDCD0x47);
            FDCDOpcodes.Add(0x43, fnFDCD0x47);
            FDCDOpcodes.Add(0x44, fnFDCD0x47);
            FDCDOpcodes.Add(0x45, fnFDCD0x47);
            FDCDOpcodes.Add(0x46, fnFDCD0x47);
            FDCDOpcodes.Add(0x4f, fnFDCD0x4f);
            FDCDOpcodes.Add(0x48, fnFDCD0x4f);
            FDCDOpcodes.Add(0x49, fnFDCD0x4f);
            FDCDOpcodes.Add(0x4a, fnFDCD0x4f);
            FDCDOpcodes.Add(0x4b, fnFDCD0x4f);
            FDCDOpcodes.Add(0x4c, fnFDCD0x4f);
            FDCDOpcodes.Add(0x4d, fnFDCD0x4f);
            FDCDOpcodes.Add(0x4e, fnFDCD0x4f);
            FDCDOpcodes.Add(0x57, fnFDCD0x57);
            FDCDOpcodes.Add(0x50, fnFDCD0x57);
            FDCDOpcodes.Add(0x51, fnFDCD0x57);
            FDCDOpcodes.Add(0x52, fnFDCD0x57);
            FDCDOpcodes.Add(0x53, fnFDCD0x57);
            FDCDOpcodes.Add(0x54, fnFDCD0x57);
            FDCDOpcodes.Add(0x55, fnFDCD0x57);
            FDCDOpcodes.Add(0x56, fnFDCD0x57);
            FDCDOpcodes.Add(0x5f, fnFDCD0x5f);
            FDCDOpcodes.Add(0x58, fnFDCD0x5f);
            FDCDOpcodes.Add(0x59, fnFDCD0x5f);
            FDCDOpcodes.Add(0x5a, fnFDCD0x5f);
            FDCDOpcodes.Add(0x5b, fnFDCD0x5f);
            FDCDOpcodes.Add(0x5c, fnFDCD0x5f);
            FDCDOpcodes.Add(0x5d, fnFDCD0x5f);
            FDCDOpcodes.Add(0x5e, fnFDCD0x5f);
            FDCDOpcodes.Add(0x67, fnFDCD0x67);
            FDCDOpcodes.Add(0x60, fnFDCD0x67);
            FDCDOpcodes.Add(0x61, fnFDCD0x67);
            FDCDOpcodes.Add(0x62, fnFDCD0x67);
            FDCDOpcodes.Add(0x63, fnFDCD0x67);
            FDCDOpcodes.Add(0x64, fnFDCD0x67);
            FDCDOpcodes.Add(0x65, fnFDCD0x67);
            FDCDOpcodes.Add(0x66, fnFDCD0x67);
            FDCDOpcodes.Add(0x6f, fnFDCD0x6f);
            FDCDOpcodes.Add(0x68, fnFDCD0x6f);
            FDCDOpcodes.Add(0x69, fnFDCD0x6f);
            FDCDOpcodes.Add(0x6a, fnFDCD0x6f);
            FDCDOpcodes.Add(0x6b, fnFDCD0x6f);
            FDCDOpcodes.Add(0x6c, fnFDCD0x6f);
            FDCDOpcodes.Add(0x6d, fnFDCD0x6f);
            FDCDOpcodes.Add(0x6e, fnFDCD0x6f);
            FDCDOpcodes.Add(0x77, fnFDCD0x77);
            FDCDOpcodes.Add(0x70, fnFDCD0x77);
            FDCDOpcodes.Add(0x71, fnFDCD0x77);
            FDCDOpcodes.Add(0x72, fnFDCD0x77);
            FDCDOpcodes.Add(0x73, fnFDCD0x77);
            FDCDOpcodes.Add(0x74, fnFDCD0x77);
            FDCDOpcodes.Add(0x75, fnFDCD0x77);
            FDCDOpcodes.Add(0x76, fnFDCD0x77);
            FDCDOpcodes.Add(0x7f, fnFDCD0x7f);
            FDCDOpcodes.Add(0x78, fnFDCD0x7f);
            FDCDOpcodes.Add(0x79, fnFDCD0x7f);
            FDCDOpcodes.Add(0x7a, fnFDCD0x7f);
            FDCDOpcodes.Add(0x7b, fnFDCD0x7f);
            FDCDOpcodes.Add(0x7c, fnFDCD0x7f);
            FDCDOpcodes.Add(0x7d, fnFDCD0x7f);
            FDCDOpcodes.Add(0x7e, fnFDCD0x7f);
            FDCDOpcodes.Add(0x80, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x81, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x82, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x83, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x84, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x85, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x86, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfe);
            }));
            FDCDOpcodes.Add(0x87, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfe;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x88, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x89, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x8a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x8b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x8c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x8d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x8e, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfd);
            }));
            FDCDOpcodes.Add(0x8f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfd;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x90, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x91, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x92, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x93, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x94, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x95, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x96, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xfb);
            }));
            FDCDOpcodes.Add(0x97, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xfb;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0x98, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0x99, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0x9a, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0x9b, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0x9c, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0x9d, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0x9e, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xf7);
            }));
            FDCDOpcodes.Add(0x9f, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xf7;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xa0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xa1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xa2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xa3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xa4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xa5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xa6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xef);
            }));
            FDCDOpcodes.Add(0xa7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xef;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xa8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xa9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xaa, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xab, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xac, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xad, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xae, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xdf);
            }));
            FDCDOpcodes.Add(0xaf, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xdf;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xb0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xb1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xb2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xb3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xb4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xb5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xb6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0xbf);
            }));
            FDCDOpcodes.Add(0xb7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0xbf;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xb8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xb9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xba, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xbb, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xbc, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xbd, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xbe, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) & 0x7f);
            }));
            FDCDOpcodes.Add(0xbf, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) & 0x7f;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xc0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xc1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xc2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xc3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xc4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xc5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xc6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x01);
            }));
            FDCDOpcodes.Add(0xc7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x01;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xc8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xc9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xca, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xcb, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xcc, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xcd, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xce, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x02);
            }));
            FDCDOpcodes.Add(0xcf, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x02;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xd0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xd1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xd2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xd3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xd4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xd5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xd6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x04);
            }));
            FDCDOpcodes.Add(0xd7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x04;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xd8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xd9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xda, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xdb, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xdc, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xdd, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xde, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x08);
            }));
            FDCDOpcodes.Add(0xdf, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x08;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xe0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xe1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xe2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xe3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xe4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xe5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xe6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x10);
            }));
            FDCDOpcodes.Add(0xe7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x10;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xe8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xe9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xea, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xeb, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xec, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xed, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xee, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x20);
            }));
            FDCDOpcodes.Add(0xef, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x20;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xf0, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xf1, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xf2, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xf3, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xf4, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xf5, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xf6, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x40);
            }));
            FDCDOpcodes.Add(0xf7, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x40;
                this.memory.writebyte(tempaddr, this.a);
            }));
            FDCDOpcodes.Add(0xf8, (tempaddr =>
            {
                this.tstates += 8;
                this.b = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.b);
            }));
            FDCDOpcodes.Add(0xf9, (tempaddr =>
            {
                this.tstates += 8;
                this.c = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.c);
            }));
            FDCDOpcodes.Add(0xfa, (tempaddr =>
            {
                this.tstates += 8;
                this.d = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.d);
            }));
            FDCDOpcodes.Add(0xfb, (tempaddr =>
            {
                this.tstates += 8;
                this.e = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.e);
            }));
            FDCDOpcodes.Add(0xfc, (tempaddr =>
            {
                this.tstates += 8;
                this.h = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.h);
            }));
            FDCDOpcodes.Add(0xfd, (tempaddr =>
            {
                this.tstates += 8;
                this.l = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.l);
            }));
            FDCDOpcodes.Add(0xfe, (tempaddr =>
            {
                this.tstates += 8;
                this.memory.writebyte(tempaddr, this.memory.readbyte(tempaddr) | 0x80);
            }));
            FDCDOpcodes.Add(0xff, (tempaddr =>
            {
                this.tstates += 8;
                this.a = this.memory.readbyte(tempaddr) | 0x80;
                this.memory.writebyte(tempaddr, this.a);
            }));

            #endregion

            var FDOpcodes = new Dictionary<Num, Action>();
            #region FD Opcodes

            var fnFDdefault = new Action(() =>
            {
                this.pc--;
                this.pc &= 0xffff;
                this.r--;
                this.r &= 0x7f;
            });
            //    //    //--------------------------------------------;

            FDOpcodes.Add(0x00, fnFDdefault);
            FDOpcodes.Add(0x01, fnFDdefault);
            FDOpcodes.Add(0x02, fnFDdefault);
            FDOpcodes.Add(0x03, fnFDdefault);
            FDOpcodes.Add(0x04, fnFDdefault);
            FDOpcodes.Add(0x05, fnFDdefault);
            FDOpcodes.Add(0x06, fnFDdefault);
            FDOpcodes.Add(0x07, fnFDdefault);
            FDOpcodes.Add(0x08, fnFDdefault);
            FDOpcodes.Add(0x09, (() =>
            {
                Num add16temp = (this.iyl | (this.iyh << 8)) + (this.c | (this.b << 8)),
                    lookup = (((this.iyl | (this.iyh << 8)) & 0x0800) >> 11) | ((((this.c | (this.b << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.iyh = (add16temp >> 8) & 0xff;
                this.iyl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            FDOpcodes.Add(0x0a, fnFDdefault);
            FDOpcodes.Add(0x0b, fnFDdefault);
            FDOpcodes.Add(0x0c, fnFDdefault);
            FDOpcodes.Add(0x0d, fnFDdefault);
            FDOpcodes.Add(0x0e, fnFDdefault);
            FDOpcodes.Add(0x0f, fnFDdefault);
            FDOpcodes.Add(0x10, fnFDdefault);
            FDOpcodes.Add(0x11, fnFDdefault);
            FDOpcodes.Add(0x12, fnFDdefault);
            FDOpcodes.Add(0x13, fnFDdefault);
            FDOpcodes.Add(0x14, fnFDdefault);
            FDOpcodes.Add(0x15, fnFDdefault);
            FDOpcodes.Add(0x16, fnFDdefault);
            FDOpcodes.Add(0x17, fnFDdefault);
            FDOpcodes.Add(0x18, fnFDdefault);
            FDOpcodes.Add(0x19, (() =>
            {
                Num add16temp = ((this.iyl | (this.iyh << 8))) + ((this.e | (this.d << 8))),
                    lookup = ((((this.iyl | (this.iyh << 8))) & 0x0800) >> 11) | ((((this.e | (this.d << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.iyh = (add16temp >> 8) & 0xff;
                this.iyl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            FDOpcodes.Add(0x1a, fnFDdefault);
            FDOpcodes.Add(0x1b, fnFDdefault);
            FDOpcodes.Add(0x1c, fnFDdefault);
            FDOpcodes.Add(0x1d, fnFDdefault);
            FDOpcodes.Add(0x1e, fnFDdefault);
            FDOpcodes.Add(0x1f, fnFDdefault);
            FDOpcodes.Add(0x20, fnFDdefault);
            FDOpcodes.Add(0x21, (() =>
            {
                this.tstates += 3;
                this.iyl = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.iyh = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x22, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.iyl);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.iyh);
            }));
            FDOpcodes.Add(0x23, (() =>
            {
                this.tstates += 2;
                var wordtemp = ((this.iyl | (this.iyh << 8)) + 1) & 0xffff;
                this.iyh = wordtemp >> 8;
                this.iyl = wordtemp & 0xff;
            }));
            FDOpcodes.Add(0x24, (() =>
            {
                this.iyh = (this.iyh + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.iyh == 0x80 ? 0x04 : 0) | (((this.iyh & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.iyh];
            }));
            FDOpcodes.Add(0x25, (() =>
            {
                this.f = (this.f & 0x01) | (((this.iyh & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.iyh = (this.iyh - 1) & 0xff;
                this.f |= (this.iyh == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.iyh];
            }));
            FDOpcodes.Add(0x26, (() =>
            {
                this.tstates += 3;
                this.iyh = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x27, fnFDdefault);
            FDOpcodes.Add(0x28, fnFDdefault);
            FDOpcodes.Add(0x29, (() =>
            {
                Num add16temp = ((this.iyl | (this.iyh << 8))) + ((this.iyl | (this.iyh << 8))),
                    lookup = ((((this.iyl | (this.iyh << 8))) & 0x0800) >> 11) | ((((this.iyl | (this.iyh << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.iyh = (add16temp >> 8) & 0xff;
                this.iyl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            FDOpcodes.Add(0x2a, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.iyl = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.iyh = this.memory.readbyte(ldtemp);
            }));
            FDOpcodes.Add(0x2b, (() =>
            {
                this.tstates += 2;
                var wordtemp = ((this.iyl | (this.iyh << 8)) - 1) & 0xffff;
                this.iyh = wordtemp >> 8;
                this.iyl = wordtemp & 0xff;
            }));
            FDOpcodes.Add(0x2c, (() =>
            {
                this.iyl = (this.iyl + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.iyl == 0x80 ? 0x04 : 0) | (((this.iyl & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.iyl];
            }));
            FDOpcodes.Add(0x2d, (() =>
            {
                this.f = (this.f & 0x01) | (((this.iyl & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.iyl = (this.iyl - 1) & 0xff;
                this.f |= (this.iyl == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.iyl];
            }));
            FDOpcodes.Add(0x2e, (() =>
            {
                this.tstates += 3;
                this.iyl = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x2f, fnFDdefault);
            FDOpcodes.Add(0x30, fnFDdefault);
            FDOpcodes.Add(0x31, fnFDdefault);
            FDOpcodes.Add(0x32, fnFDdefault);
            FDOpcodes.Add(0x33, fnFDdefault);
            FDOpcodes.Add(0x34, (() =>
            {
                this.tstates += 15;
                var wordtemp = ((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                var bytetemp = this.memory.readbyte(wordtemp);
                bytetemp = (bytetemp + 1) & 0xff;
                this.f = (this.f & 0x01) | (bytetemp == 0x80 ? 0x04 : 0) | (((bytetemp & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[bytetemp];
                this.memory.writebyte(wordtemp, bytetemp);
            }));
            FDOpcodes.Add(0x35, (() =>
            {
                this.tstates += 15;
                var wordtemp = ((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                var bytetemp = this.memory.readbyte(wordtemp);
                this.f = (this.f & 0x01) | (((bytetemp & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                bytetemp = (bytetemp - 1) & 0xff;
                this.f |= (bytetemp == 0x7f ? 0x04 : 0) | lookupTables.sz53[bytetemp];
                this.memory.writebyte(wordtemp, bytetemp);
            }));
            FDOpcodes.Add(0x36, (() =>
            {
                this.tstates += 11;
                var wordtemp = ((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff;
                this.pc &= 0xffff;
                this.memory.writebyte(wordtemp, this.memory.readbyte(this.pc++));
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x37, fnFDdefault);
            FDOpcodes.Add(0x38, fnFDdefault);
            FDOpcodes.Add(0x39, (() =>
            {
                Num add16temp = ((this.iyl | (this.iyh << 8))) + (this.sp),
                    lookup = ((((this.iyl | (this.iyh << 8))) & 0x0800) >> 11) | (((this.sp) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.iyh = (add16temp >> 8) & 0xff;
                this.iyl = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            FDOpcodes.Add(0x3a, fnFDdefault);
            FDOpcodes.Add(0x3b, fnFDdefault);
            FDOpcodes.Add(0x3c, fnFDdefault);
            FDOpcodes.Add(0x3d, fnFDdefault);
            FDOpcodes.Add(0x3e, fnFDdefault);
            FDOpcodes.Add(0x3f, fnFDdefault);
            FDOpcodes.Add(0x40, fnFDdefault);
            FDOpcodes.Add(0x41, fnFDdefault);
            FDOpcodes.Add(0x42, fnFDdefault);
            FDOpcodes.Add(0x43, fnFDdefault);
            FDOpcodes.Add(0x44, (() =>
            {
                this.b = this.iyh;
            }));
            FDOpcodes.Add(0x45, (() =>
            {
                this.b = this.iyl;
            }));
            FDOpcodes.Add(0x46, (() =>
            {
                this.tstates += 11;
                this.b = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x47, fnFDdefault);
            FDOpcodes.Add(0x48, fnFDdefault);
            FDOpcodes.Add(0x49, fnFDdefault);
            FDOpcodes.Add(0x4a, fnFDdefault);
            FDOpcodes.Add(0x4b, fnFDdefault);
            FDOpcodes.Add(0x4c, (() =>
            {
                this.c = this.iyh;
            }));
            FDOpcodes.Add(0x4d, (() =>
            {
                this.c = this.iyl;
            }));
            FDOpcodes.Add(0x4e, (() =>
            {
                this.tstates += 11;
                this.c = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x4f, fnFDdefault);
            FDOpcodes.Add(0x50, fnFDdefault);
            FDOpcodes.Add(0x51, fnFDdefault);
            FDOpcodes.Add(0x52, fnFDdefault);
            FDOpcodes.Add(0x53, fnFDdefault);
            FDOpcodes.Add(0x54, (() =>
            {
                this.d = this.iyh;
            }));
            FDOpcodes.Add(0x55, (() =>
            {
                this.d = this.iyl;
            }));
            FDOpcodes.Add(0x56, (() =>
            {
                this.tstates += 11;
                this.d = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x57, fnFDdefault);
            FDOpcodes.Add(0x58, fnFDdefault);
            FDOpcodes.Add(0x59, fnFDdefault);
            FDOpcodes.Add(0x5a, fnFDdefault);
            FDOpcodes.Add(0x5b, fnFDdefault);
            FDOpcodes.Add(0x5c, (() =>
            {
                this.e = this.iyh;
            }));
            FDOpcodes.Add(0x5d, (() =>
            {
                this.e = this.iyl;
            }));
            FDOpcodes.Add(0x5e, (() =>
            {
                this.tstates += 11;
                this.e = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x5f, fnFDdefault);
            FDOpcodes.Add(0x60, (() =>
            {
                this.iyh = this.b;
            }));
            FDOpcodes.Add(0x61, (() =>
            {
                this.iyh = this.c;
            }));
            FDOpcodes.Add(0x62, (() =>
            {
                this.iyh = this.d;
            }));
            FDOpcodes.Add(0x63, (() =>
            {
                this.iyh = this.e;
            }));
            FDOpcodes.Add(0x64, (() => { }));
            FDOpcodes.Add(0x65, (() =>
            {
                this.iyh = this.iyl;
            }));
            FDOpcodes.Add(0x66, (() =>
            {
                this.tstates += 11;
                this.h = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x67, (() =>
            {
                this.iyh = this.a;
            }));
            FDOpcodes.Add(0x68, (() =>
            {
                this.iyl = this.b;
            }));
            FDOpcodes.Add(0x69, (() =>
            {
                this.iyl = this.c;
            }));
            FDOpcodes.Add(0x6a, (() =>
            {
                this.iyl = this.d;
            }));
            FDOpcodes.Add(0x6b, (() =>
            {
                this.iyl = this.e;
            }));
            FDOpcodes.Add(0x6c, (() =>
            {
                this.iyl = this.iyh;
            }));
            FDOpcodes.Add(0x6d, (() => { }));
            FDOpcodes.Add(0x6e, (() =>
            {
                this.tstates += 11;
                this.l = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x6f, (() =>
            {
                this.iyl = this.a;
            }));
            FDOpcodes.Add(0x70, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.b);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x71, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.c);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x72, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.d);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x73, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.e);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x74, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.h);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x75, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.l);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x76, fnFDdefault);
            FDOpcodes.Add(0x77, (() =>
            {
                this.tstates += 11;
                this.memory.writebyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff, this.a);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x78, fnFDdefault);
            FDOpcodes.Add(0x79, fnFDdefault);
            FDOpcodes.Add(0x7a, fnFDdefault);
            FDOpcodes.Add(0x7b, fnFDdefault);
            FDOpcodes.Add(0x7c, (() =>
            {
                this.a = this.iyh;
            }));
            FDOpcodes.Add(0x7d, (() =>
            {
                this.a = this.iyl;
            }));
            FDOpcodes.Add(0x7e, (() =>
            {
                this.tstates += 11;
                this.a = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
            }));
            FDOpcodes.Add(0x7f, fnFDdefault);
            FDOpcodes.Add(0x80, fnFDdefault);
            FDOpcodes.Add(0x81, fnFDdefault);
            FDOpcodes.Add(0x82, fnFDdefault);
            FDOpcodes.Add(0x83, fnFDdefault);
            FDOpcodes.Add(0x84, (() =>
            {
                Num addtemp = this.a + this.iyh,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyh & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x85, (() =>
            {
                Num addtemp = this.a + this.iyl,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyl & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x86, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                Num addtemp = this.a + bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x87, fnFDdefault);
            FDOpcodes.Add(0x88, fnFDdefault);
            FDOpcodes.Add(0x89, fnFDdefault);
            FDOpcodes.Add(0x8a, fnFDdefault);
            FDOpcodes.Add(0x8b, fnFDdefault);
            FDOpcodes.Add(0x8c, (() =>
            {
                Num adctemp = this.a + this.iyh + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyh & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x8d, (() =>
            {
                Num adctemp = this.a + this.iyl + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyl & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x8e, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                Num adctemp = this.a + bytetemp + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x8f, fnFDdefault);
            FDOpcodes.Add(0x90, fnFDdefault);
            FDOpcodes.Add(0x91, fnFDdefault);
            FDOpcodes.Add(0x92, fnFDdefault);
            FDOpcodes.Add(0x93, fnFDdefault);
            FDOpcodes.Add(0x94, (() =>
            {
                Num subtemp = this.a - this.iyh,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyh & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x95, (() =>
            {
                Num subtemp = this.a - this.iyl,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyl & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x96, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                Num subtemp = this.a - bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x97, fnFDdefault);
            FDOpcodes.Add(0x98, fnFDdefault);
            FDOpcodes.Add(0x99, fnFDdefault);
            FDOpcodes.Add(0x9a, fnFDdefault);
            FDOpcodes.Add(0x9b, fnFDdefault);
            FDOpcodes.Add(0x9c, (() =>
            {
                Num sbctemp = this.a - this.iyh - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyh & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x9d, (() =>
            {
                Num sbctemp = this.a - this.iyl - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyl & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x9e, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                Num sbctemp = this.a - bytetemp - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            FDOpcodes.Add(0x9f, fnFDdefault);
            FDOpcodes.Add(0xa0, fnFDdefault);
            FDOpcodes.Add(0xa1, fnFDdefault);
            FDOpcodes.Add(0xa2, fnFDdefault);
            FDOpcodes.Add(0xa3, fnFDdefault);
            FDOpcodes.Add(0xa4, (() =>
            {
                this.a &= this.iyh;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xa5, (() =>
            {
                this.a &= this.iyl;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xa6, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a &= bytetemp;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xa7, fnFDdefault);
            FDOpcodes.Add(0xa8, fnFDdefault);
            FDOpcodes.Add(0xa9, fnFDdefault);
            FDOpcodes.Add(0xaa, fnFDdefault);
            FDOpcodes.Add(0xab, fnFDdefault);
            FDOpcodes.Add(0xac, (() =>
            {
                this.a ^= this.iyh;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xad, (() =>
            {
                this.a ^= this.iyl;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xae, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a ^= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xaf, fnFDdefault);
            FDOpcodes.Add(0xb0, fnFDdefault);
            FDOpcodes.Add(0xb1, fnFDdefault);
            FDOpcodes.Add(0xb2, fnFDdefault);
            FDOpcodes.Add(0xb3, fnFDdefault);
            FDOpcodes.Add(0xb4, (() =>
            {
                this.a |= this.iyh;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xb5, (() =>
            {
                this.a |= this.iyl;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xb6, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                this.a |= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            FDOpcodes.Add(0xb7, fnFDdefault);
            FDOpcodes.Add(0xb8, fnFDdefault);
            FDOpcodes.Add(0xb9, fnFDdefault);
            FDOpcodes.Add(0xba, fnFDdefault);
            FDOpcodes.Add(0xbb, fnFDdefault);
            FDOpcodes.Add(0xbc, (() =>
            {
                Num cptemp = this.a - this.iyh,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyh & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = (((cptemp & 0x100) > 0) ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.iyh & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            FDOpcodes.Add(0xbd, (() =>
            {
                Num cptemp = this.a - this.iyl,
                    lookup = ((this.a & 0x88) >> 3) | ((this.iyl & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = (((cptemp & 0x100) > 0) ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.iyl & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            FDOpcodes.Add(0xbe, (() =>
            {
                this.tstates += 11;
                var bytetemp = this.memory.readbyte(((this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++))) & 0xffff);
                this.pc &= 0xffff;
                Num cptemp = this.a - bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = (((cptemp & 0x100) > 0) ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (bytetemp & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            FDOpcodes.Add(0xbf, fnFDdefault);
            FDOpcodes.Add(0xc0, fnFDdefault);
            FDOpcodes.Add(0xc1, fnFDdefault);
            FDOpcodes.Add(0xc2, fnFDdefault);
            FDOpcodes.Add(0xc3, fnFDdefault);
            FDOpcodes.Add(0xc4, fnFDdefault);
            FDOpcodes.Add(0xc5, fnFDdefault);
            FDOpcodes.Add(0xc6, fnFDdefault);
            FDOpcodes.Add(0xc7, fnFDdefault);
            FDOpcodes.Add(0xc8, fnFDdefault);
            FDOpcodes.Add(0xc9, fnFDdefault);
            FDOpcodes.Add(0xca, fnFDdefault);
            FDOpcodes.Add(0xcb, (() =>
            {
                this.tstates += 3;
                var tempaddr = (this.iyl | (this.iyh << 8)) + sign_extend(this.memory.readbyte(this.pc++));
                this.pc &= 0xffff;
                this.tstates += 4;
                var opcode3 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                FDCDOpcodes[opcode3].Invoke(tempaddr);
            }));
            FDOpcodes.Add(0xcc, fnFDdefault);
            FDOpcodes.Add(0xcd, fnFDdefault);
            FDOpcodes.Add(0xce, fnFDdefault);
            FDOpcodes.Add(0xcf, fnFDdefault);
            FDOpcodes.Add(0xd0, fnFDdefault);
            FDOpcodes.Add(0xd1, fnFDdefault);
            FDOpcodes.Add(0xd2, fnFDdefault);
            FDOpcodes.Add(0xd3, fnFDdefault);
            FDOpcodes.Add(0xd4, fnFDdefault);
            FDOpcodes.Add(0xd5, fnFDdefault);
            FDOpcodes.Add(0xd6, fnFDdefault);
            FDOpcodes.Add(0xd7, fnFDdefault);
            FDOpcodes.Add(0xd8, fnFDdefault);
            FDOpcodes.Add(0xd9, fnFDdefault);
            FDOpcodes.Add(0xda, fnFDdefault);
            FDOpcodes.Add(0xdb, fnFDdefault);
            FDOpcodes.Add(0xdc, fnFDdefault);
            FDOpcodes.Add(0xdd, fnFDdefault);
            FDOpcodes.Add(0xde, fnFDdefault);
            FDOpcodes.Add(0xdf, fnFDdefault);
            FDOpcodes.Add(0xe0, fnFDdefault);
            FDOpcodes.Add(0xe1, (() =>
            {
                this.tstates += 3;
                this.iyl = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.iyh = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            FDOpcodes.Add(0xe2, fnFDdefault);
            FDOpcodes.Add(0xe3, (() =>
            {
                Num bytetempl = this.memory.readbyte(this.sp),
                    bytetemph = this.memory.readbyte(this.sp + 1);
                this.tstates += 15;
                this.memory.writebyte(this.sp + 1, this.iyh);
                this.memory.writebyte(this.sp, this.iyl);
                this.iyl = bytetempl;
                this.iyh = bytetemph;
            }));
            FDOpcodes.Add(0xe4, fnFDdefault);
            FDOpcodes.Add(0xe5, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.iyh);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.iyl);
            }));
            FDOpcodes.Add(0xe6, fnFDdefault);
            FDOpcodes.Add(0xe7, fnFDdefault);
            FDOpcodes.Add(0xe8, fnFDdefault);
            FDOpcodes.Add(0xe9, (() =>
            {
                this.pc = (this.iyl | (this.iyh << 8));
            }));
            FDOpcodes.Add(0xea, fnFDdefault);
            FDOpcodes.Add(0xeb, fnFDdefault);
            FDOpcodes.Add(0xec, fnFDdefault);
            FDOpcodes.Add(0xed, fnFDdefault);
            FDOpcodes.Add(0xee, fnFDdefault);
            FDOpcodes.Add(0xef, fnFDdefault);
            FDOpcodes.Add(0xf0, fnFDdefault);
            FDOpcodes.Add(0xf1, fnFDdefault);
            FDOpcodes.Add(0xf2, fnFDdefault);
            FDOpcodes.Add(0xf3, fnFDdefault);
            FDOpcodes.Add(0xf4, fnFDdefault);
            FDOpcodes.Add(0xf5, fnFDdefault);
            FDOpcodes.Add(0xf6, fnFDdefault);
            FDOpcodes.Add(0xf7, fnFDdefault);
            FDOpcodes.Add(0xf8, fnFDdefault);
            FDOpcodes.Add(0xf9, (() =>
            {
                this.tstates += 2;
                this.sp = (this.iyl | (this.iyh << 8));
            }));
            FDOpcodes.Add(0xfa, fnFDdefault);
            FDOpcodes.Add(0xfb, fnFDdefault);
            FDOpcodes.Add(0xfc, fnFDdefault);
            FDOpcodes.Add(0xfd, fnFDdefault);
            FDOpcodes.Add(0xfe, fnFDdefault);
            FDOpcodes.Add(0xff, fnFDdefault);

            //    //    //--------------------------------------------;
            #endregion

            //    //    //--------------------------------------------;
            _Opcodes = new Dictionary<Num, Action>();
            #region Opcodes
            
            //--------------------------------------------; 	
            _Opcodes.Add(0x00, fnDoNuffink);
            _Opcodes.Add(0x01, (() =>
            {
                this.tstates += 3;
                this.c = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.b = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x02, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.c | (this.b << 8)), this.a);
            }));
            _Opcodes.Add(0x03, (() =>
            {
                this.tstates += 2;
                var wordtemp = ((this.c | (this.b << 8)) + 1) & 0xffff;
                this.b = wordtemp >> 8;
                this.c = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x04, (() =>
            {
                this.b = (this.b + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.b == 0x80 ? 0x04 : 0) | (((this.b & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.b];
            }));
            _Opcodes.Add(0x05, (() =>
            {
                this.f = (this.f & 0x01) | (((this.b & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.b = (this.b - 1) & 0xff;
                this.f |= (this.b == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.b];
            }));
            _Opcodes.Add(0x06, (() =>
            {
                this.tstates += 3;
                this.b = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x07, (() =>
            {
                this.a = ((this.a & 0x7f) << 1) | (this.a >> 7);
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (this.a & (0x01 | 0x08 | 0x20));
            }));
            _Opcodes.Add(0x08, (() =>
            {
                if (this.pc == 0x04d1 || this.pc == 0x0077)
                {
                    //if (tape_save_trap() == 0) return;
                    throw new NotImplementedException("Can't load from tapes");
                }
                Num olda = this.a,
                    oldf = this.f;
                this.a = this.a_;
                this.f = this.f_;
                this.a_ = olda;
                this.f_ = oldf;
            }));
            _Opcodes.Add(0x09, (() =>
            {
                Num add16temp = ((this.l | (this.h << 8))) + ((this.c | (this.b << 8))),
                    lookup = ((((this.l | (this.h << 8))) & 0x0800) >> 11) | ((((this.c | (this.b << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            _Opcodes.Add(0x0a, (() =>
            {
                this.tstates += 3;
                this.a = this.memory.readbyte((this.c | (this.b << 8)));
            }));
            _Opcodes.Add(0x0b, (() =>
            {
                this.tstates += 2;
                Num wordtemp = ((this.c | (this.b << 8)) - 1) & 0xffff;
                this.b = wordtemp >> 8;
                this.c = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x0c, (() =>
            {
                this.c = (this.c + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.c == 0x80 ? 0x04 : 0) | (((this.c & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.c];
            }));
            _Opcodes.Add(0x0d, (() =>
            {
                this.f = ((((this.f & 0x01) | (this.c & 0x0f)) > 0) ? 0 : 0x10) | 0x02;
                this.c = (this.c - 1) & 0xff;
                this.f |= (this.c == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.c];
            }));
            _Opcodes.Add(0x0e, (() =>
            {
                this.tstates += 3;
                this.c = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x0f, (() =>
            {
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (this.a & 0x01);
                this.a = (this.a >> 1) | ((this.a & 0x01) << 7);
                this.f |= (this.a & (0x08 | 0x20));
            }));
            _Opcodes.Add(0x10, (() =>
            {
                this.tstates++;
                this.tstates += 3;
                this.b = (this.b - 1) & 0xff;
                if (this.b > 0)
                {
                    this.tstates += 1;
                    this.tstates += 1;
                    this.tstates += 1;
                    this.tstates += 1;
                    this.tstates += 1;
                    this.pc += sign_extend(this.memory.readbyte(this.pc));
                    this.pc &= 0xffff;
                }
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x11, (() =>
            {
                this.tstates += 3;
                this.e = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.d = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x12, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.e | (this.d << 8)), this.a);
            }));
            _Opcodes.Add(0x13, (() =>
            {
                this.tstates += 2;
                Num wordtemp = ((this.e | (this.d << 8)) + 1) & 0xffff;
                this.d = wordtemp >> 8;
                this.e = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x14, (() =>
            {
                this.d = (this.d + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.d == 0x80 ? 0x04 : 0) | (((this.d & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.d];
            }));
            _Opcodes.Add(0x15, (() =>
            {
                this.f = (this.f & 0x01) | (((this.d & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.d = (this.d - 1) & 0xff;
                this.f |= (this.d == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.d];
            }));
            _Opcodes.Add(0x16, (() =>
            {
                this.tstates += 3;
                this.d = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x17, (() =>
            {
                Num bytetemp = this.a;
                this.a = ((this.a & 0x7f) << 1) | (this.f & 0x01);
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (this.a & (0x08 | 0x20)) | (bytetemp >> 7);
            }));
            _Opcodes.Add(0x18, (() =>
            {
                this.tstates += 8;
                this.pc += sign_extend(this.memory.readbyte(this.pc));
                this.pc &= 0xffff;
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x19, (() =>
            {
                Num add16temp = ((this.l | (this.h << 8))) + ((this.e | (this.d << 8))),
                    lookup = ((((this.l | (this.h << 8))) & 0x0800) >> 11) | ((((this.e | (this.d << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            _Opcodes.Add(0x1a, (() =>
            {
                this.tstates += 3;
                this.a = this.memory.readbyte((this.e | (this.d << 8)));
            }));
            _Opcodes.Add(0x1b, (() =>
            {
                this.tstates += 2;
                Num wordtemp = ((this.e | (this.d << 8)) - 1) & 0xffff;
                this.d = wordtemp >> 8;
                this.e = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x1c, (() =>
            {
                this.e = (this.e + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.e == 0x80 ? 0x04 : 0) | (((this.e & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.e];
            }));
            _Opcodes.Add(0x1d, (() =>
            {
                this.f = (this.f & 0x01) | (((this.e & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.e = (this.e - 1) & 0xff;
                this.f |= (this.e == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.e];
            }));
            _Opcodes.Add(0x1e, (() =>
            {
                this.tstates += 3;
                this.e = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x1f, (() =>
            {
                Num bytetemp = this.a;
                this.a = (this.a >> 1) | ((this.f & 0x01) << 7);
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (this.a & (0x08 | 0x20)) | (bytetemp & 0x01);
            }));
            _Opcodes.Add(0x20, (() =>
            {
                this.tstates += 3;
                if (!(((this.f & 0x40) > 0)))
                {
                    this.tstates += 5;
                    this.pc += sign_extend(this.memory.readbyte(this.pc));
                    this.pc &= 0xffff;
                }
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x21, (() =>
            {
                this.tstates += 3;
                this.l = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.h = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x22, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp++, this.l);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(ldtemp, this.h);
            }));
            _Opcodes.Add(0x23, (() =>
            {
                this.tstates += 2;
                Num wordtemp = ((this.l | (this.h << 8)) + 1) & 0xffff;
                this.h = wordtemp >> 8;
                this.l = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x24, (() =>
            {
                this.h = (this.h + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.h == 0x80 ? 0x04 : 0) | (((this.h & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.h];
            }));
            _Opcodes.Add(0x25, (() =>
            {
                this.f = (this.f & 0x01) | (((this.h & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.h = (this.h - 1) & 0xff;
                this.f |= (this.h == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.h];
            }));
            _Opcodes.Add(0x26, (() =>
            {
                this.tstates += 3;
                this.h = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x27, (() =>
            {
                Num add = 0,
                    carry = (this.f & 0x01);
                if ((((this.f & 0x10) > 0)) || ((this.a & 0x0f) > 9)) add = 6;
                if ((carry > 0) || (this.a > 0x99)) add |= 0x60;
                if (this.a > 0x99) carry = 0x01;
                if ((this.f & 0x02) > 0)
                {
                    Num subtemp = this.a - (add),
                        lookup = ((this.a & 0x88) >> 3) | (((add) & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                    this.a = subtemp & 0xff;
                    this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
                }
                else
                {
                    Num addtemp = this.a + (add),
                        lookup = ((this.a & 0x88) >> 3) | (((add) & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                    this.a = addtemp & 0xff;
                    this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
                }
                this.f = (this.f & ~(0x01 | 0x04)) | carry | lookupTables.parity[this.a];
            }));
            _Opcodes.Add(0x28, (() =>
            {
                this.tstates += 3;
                if (((this.f & 0x40) > 0))
                {
                    this.tstates += 5;
                    this.pc += sign_extend(this.memory.readbyte(this.pc));
                    this.pc &= 0xffff;
                }
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x29, (() =>
            {
                Num add16temp = ((this.l | (this.h << 8))) + ((this.l | (this.h << 8))),
                    lookup = ((((this.l | (this.h << 8))) & 0x0800) >> 11) | ((((this.l | (this.h << 8))) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            _Opcodes.Add(0x2a, (() =>
            {
                Num ldtemp;
                this.tstates += 3;
                ldtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                ldtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.l = this.memory.readbyte(ldtemp++);
                ldtemp &= 0xffff;
                this.tstates += 3;
                this.h = this.memory.readbyte(ldtemp);
            }));
            _Opcodes.Add(0x2b, (() =>
            {
                this.tstates += 2;
                Num wordtemp = ((this.l | (this.h << 8)) - 1) & 0xffff;
                this.h = wordtemp >> 8;
                this.l = wordtemp & 0xff;
            }));
            _Opcodes.Add(0x2c, (() =>
            {
                this.l = (this.l + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.l == 0x80 ? 0x04 : 0) | (((this.l & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.l];
            }));
            _Opcodes.Add(0x2d, (() =>
            {
                this.f = (this.f & 0x01) | (((this.l & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                this.l = (this.l - 1) & 0xff;
                this.f |= (this.l == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.l];
            }));
            _Opcodes.Add(0x2e, (() =>
            {
                this.tstates += 3;
                this.l = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x2f, (() =>
            {
                this.a ^= 0xff;
                this.f = (this.f & (0x01 | 0x04 | 0x40 | 0x80)) | (this.a & (0x08 | 0x20)) | (0x02 | 0x10);
            }));
            _Opcodes.Add(0x30, (() =>
            {
                this.tstates += 3;
                if (!((this.f & 0x01) > 0))
                {
                    this.tstates += 5;
                    this.pc += sign_extend(this.memory.readbyte(this.pc));
                    this.pc &= 0xffff;
                }
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x31, (() =>
            {
                this.tstates += 3;
                Num splow = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                Num sphigh = this.memory.readbyte(this.pc++);
                this.sp = splow | (sphigh << 8);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x32, (() =>
            {
                this.tstates += 3;
                Num wordtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                wordtemp |= this.memory.readbyte(this.pc++) << 8;
                this.pc &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(wordtemp, this.a);
            }));
            _Opcodes.Add(0x33, (() =>
            {
                this.tstates += 2;
                this.sp = (this.sp + 1) & 0xffff;
            }));
            _Opcodes.Add(0x34, (() =>
            {
                this.tstates += 4;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                bytetemp = (bytetemp + 1) & 0xff;
                this.f = (this.f & 0x01) | (bytetemp == 0x80 ? 0x04 : 0) | (((bytetemp & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[bytetemp];
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            _Opcodes.Add(0x35, (() =>
            {
                this.tstates += 4;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.f = (this.f & 0x01) | (((bytetemp & 0x0f) > 0) ? 0 : 0x10) | 0x02;
                bytetemp = (bytetemp - 1) & 0xff;
                this.f |= (bytetemp == 0x7f ? 0x04 : 0) | lookupTables.sz53[bytetemp];
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), bytetemp);
            }));
            _Opcodes.Add(0x36, (() =>
            {
                this.tstates += 6;
                this.memory.writebyte((this.l | (this.h << 8)), this.memory.readbyte(this.pc++));
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x37, (() =>
            {
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (this.a & (0x08 | 0x20)) | 0x01;
            }));
            _Opcodes.Add(0x38, (() =>
            {
                this.tstates += 3;
                if ((this.f & 0x01) > 0)
                {
                    this.tstates += 5;
                    this.pc += sign_extend(this.memory.readbyte(this.pc));
                    this.pc &= 0xffff;
                }
                this.pc++;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x39, (() =>
            {
                Num add16temp = ((this.l | (this.h << 8))) + (this.sp),
                    lookup = ((((this.l | (this.h << 8))) & 0x0800) >> 11) | (((this.sp) & 0x0800) >> 10) | ((add16temp & 0x0800) >> 9);
                this.tstates += 7;
                this.h = (add16temp >> 8) & 0xff;
                this.l = add16temp & 0xff;
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((add16temp & 0x10000) > 0) ? 0x01 : 0) | ((add16temp >> 8) & (0x08 | 0x20)) | lookupTables.halfcarry_add[lookup];
            }));
            _Opcodes.Add(0x3a, (() =>
            {
                Num wordtemp;
                this.tstates += 3;
                wordtemp = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 3;
                wordtemp |= (this.memory.readbyte(this.pc++) << 8);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.a = this.memory.readbyte(wordtemp);
            }));
            _Opcodes.Add(0x3b, (() =>
            {
                this.tstates += 2;
                this.sp = (this.sp - 1) & 0xffff;
            }));
            _Opcodes.Add(0x3c, (() =>
            {
                this.a = (this.a + 1) & 0xff;
                this.f = (this.f & 0x01) | (this.a == 0x80 ? 0x04 : 0) | (((this.a & 0x0f) > 0) ? 0 : 0x10) | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x3d, (() =>
            {
                this.f = ((((this.f & 0x01) | (this.a & 0x0f)) > 0) ? 0 : 0x10) | 0x02;
                this.a = (this.a - 1) & 0xff;
                this.f |= (this.a == 0x7f ? 0x04 : 0) | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x3e, (() =>
            {
                this.tstates += 3;
                this.a = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x3f, (() =>
            {
                this.f = (this.f & (0x04 | 0x40 | 0x80)) | (((this.f & 0x01) > 0) ? 0x10 : 0x01) | (this.a & (0x08 | 0x20));
            }));
            _Opcodes.Add(0x40, fnDoNuffink);
            _Opcodes.Add(0x41, (() =>
            {
                this.b = this.c;
            }));
            _Opcodes.Add(0x42, (() =>
            {
                this.b = this.d;
            }));
            _Opcodes.Add(0x43, (() =>
            {
                this.b = this.e;
            }));
            _Opcodes.Add(0x44, (() =>
            {
                this.b = this.h;
            }));
            _Opcodes.Add(0x45, (() =>
            {
                this.b = this.l;
            }));
            _Opcodes.Add(0x46, (() =>
            {
                this.tstates += 3;
                this.b = this.memory.readbyte(this.l | (this.h << 8));
            }));
            _Opcodes.Add(0x47, (() =>
            {
                this.b = this.a;
            }));
            _Opcodes.Add(0x48, (() =>
            {
                this.c = this.b;
            }));
            _Opcodes.Add(0x49, fnDoNuffink);
            _Opcodes.Add(0x4a, (() =>
            {
                this.c = this.d;
            }));
            _Opcodes.Add(0x4b, (() =>
            {
                this.c = this.e;
            }));
            _Opcodes.Add(0x4c, (() =>
            {
                this.c = this.h;
            }));
            _Opcodes.Add(0x4d, (() =>
            {
                this.c = this.l;
            }));
            _Opcodes.Add(0x4e, (() =>
            {
                this.tstates += 3;
                this.c = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x4f, (() =>
            {
                this.c = this.a;
            }));
            _Opcodes.Add(0x50, (() =>
            {
                this.d = this.b;
            }));
            _Opcodes.Add(0x51, (() =>
            {
                this.d = this.c;
            }));
            _Opcodes.Add(0x52, fnDoNuffink);
            _Opcodes.Add(0x53, (() =>
            {
                this.d = this.e;
            }));
            _Opcodes.Add(0x54, (() =>
            {
                this.d = this.h;
            }));
            _Opcodes.Add(0x55, (() =>
            {
                this.d = this.l;
            }));
            _Opcodes.Add(0x56, (() =>
            {
                this.tstates += 3;
                this.d = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x57, (() =>
            {
                this.d = this.a;
            }));
            _Opcodes.Add(0x58, (() =>
            {
                this.e = this.b;
            }));
            _Opcodes.Add(0x59, (() =>
            {
                this.e = this.c;
            }));
            _Opcodes.Add(0x5a, (() =>
            {
                this.e = this.d;
            }));
            _Opcodes.Add(0x5b, fnDoNuffink);
            _Opcodes.Add(0x5c, (() =>
            {
                this.e = this.h;
            }));
            _Opcodes.Add(0x5d, (() =>
            {
                this.e = this.l;
            }));
            _Opcodes.Add(0x5e, (() =>
            {
                this.tstates += 3;
                this.e = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x5f, (() =>
            {
                this.e = this.a;
            }));
            _Opcodes.Add(0x60, (() =>
            {
                this.h = this.b;
            }));
            _Opcodes.Add(0x61, (() =>
            {
                this.h = this.c;
            }));
            _Opcodes.Add(0x62, (() =>
            {
                this.h = this.d;
            }));
            _Opcodes.Add(0x63, (() =>
            {
                this.h = this.e;
            }));
            _Opcodes.Add(0x64, fnDoNuffink);
            _Opcodes.Add(0x65, (() =>
            {
                this.h = this.l;
            }));
            _Opcodes.Add(0x66, (() =>
            {
                this.tstates += 3;
                this.h = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x67, (() =>
            {
                this.h = this.a;
            }));
            _Opcodes.Add(0x68, (() =>
            {
                this.l = this.b;
            }));
            _Opcodes.Add(0x69, (() =>
            {
                this.l = this.c;
            }));
            _Opcodes.Add(0x6a, (() =>
            {
                this.l = this.d;
            }));
            _Opcodes.Add(0x6b, (() =>
            {
                this.l = this.e;
            }));
            _Opcodes.Add(0x6c, (() =>
            {
                this.l = this.h;
            }));
            _Opcodes.Add(0x6d, fnDoNuffink);
            _Opcodes.Add(0x6e, (() =>
            {
                this.tstates += 3;
                this.l = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x6f, (() =>
            {
                this.l = this.a;
            }));
            _Opcodes.Add(0x70, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.b);
            }));
            _Opcodes.Add(0x71, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.c);
            }));
            _Opcodes.Add(0x72, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.d);
            }));
            _Opcodes.Add(0x73, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.e);
            }));
            _Opcodes.Add(0x74, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.h);
            }));
            _Opcodes.Add(0x75, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.l);
            }));
            _Opcodes.Add(0x76, (() =>
            {
                this.halted = true;
                this.pc--;
                this.pc &= 0xffff;
            }));
            _Opcodes.Add(0x77, (() =>
            {
                this.tstates += 3;
                this.memory.writebyte((this.l | (this.h << 8)), this.a);
            }));
            _Opcodes.Add(0x78, (() =>
            {
                this.a = this.b;
            }));
            _Opcodes.Add(0x79, (() =>
            {
                this.a = this.c;
            }));
            _Opcodes.Add(0x7a, (() =>
            {
                this.a = this.d;
            }));
            _Opcodes.Add(0x7b, (() =>
            {
                this.a = this.e;
            }));
            _Opcodes.Add(0x7c, (() =>
            {
                this.a = this.h;
            }));
            _Opcodes.Add(0x7d, (() =>
            {
                this.a = this.l;
            }));
            _Opcodes.Add(0x7e, (() =>
            {
                this.tstates += 3;
                this.a = this.memory.readbyte((this.l | (this.h << 8)));
            }));
            _Opcodes.Add(0x7f, fnDoNuffink);
            _Opcodes.Add(0x80, (() =>
            {
                Num addtemp = this.a + this.b,
                    lookup = ((this.a & 0x88) >> 3) | ((this.b & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x81, (() =>
            {
                Num addtemp = this.a + this.c,
                    lookup = ((this.a & 0x88) >> 3) | ((this.c & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x82, (() =>
            {
                Num addtemp = this.a + this.d,
                    lookup = ((this.a & 0x88) >> 3) | ((this.d & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x83, (() =>
            {
                Num addtemp = this.a + this.e,
                    lookup = ((this.a & 0x88) >> 3) | ((this.e & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x84, (() =>
            {
                Num addtemp = this.a + this.h,
                    lookup = ((this.a & 0x88) >> 3) | ((this.h & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x85, (() =>
            {
                Num addtemp = this.a + this.l,
                    lookup = ((this.a & 0x88) >> 3) | ((this.l & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x86, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8))),
                    addtemp = this.a + bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x87, (() =>
            {
                Num addtemp = this.a + this.a,
                    lookup = ((this.a & 0x88) >> 3) | ((this.a & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x88, (() =>
            {
                Num adctemp = this.a + this.b + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.b & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x89, (() =>
            {
                Num adctemp = this.a + this.c + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.c & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8a, (() =>
            {
                Num adctemp = this.a + this.d + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.d & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8b, (() =>
            {
                Num adctemp = this.a + this.e + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.e & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8c, (() =>
            {
                Num adctemp = this.a + this.h + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.h & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8d, (() =>
            {
                Num adctemp = this.a + this.l + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.l & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8e, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8))),
                    adctemp = this.a + bytetemp + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x8f, (() =>
            {
                Num adctemp = this.a + this.a + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.a & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x90, (() =>
            {
                Num subtemp = this.a - this.b,
                    lookup = ((this.a & 0x88) >> 3) | ((this.b & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x91, (() =>
            {
                Num subtemp = this.a - this.c,
                    lookup = ((this.a & 0x88) >> 3) | ((this.c & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x92, (() =>
            {
                Num subtemp = this.a - this.d,
                    lookup = ((this.a & 0x88) >> 3) | ((this.d & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x93, (() =>
            {
                Num subtemp = this.a - this.e,
                    lookup = ((this.a & 0x88) >> 3) | ((this.e & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x94, (() =>
            {
                Num subtemp = this.a - this.h,
                    lookup = ((this.a & 0x88) >> 3) | ((this.h & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x95, (() =>
            {
                Num subtemp = this.a - this.l,
                    lookup = ((this.a & 0x88) >> 3) | ((this.l & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x96, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8))),
                    subtemp = this.a - bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x97, (() =>
            {
                Num subtemp = this.a - this.a,
                    lookup = ((this.a & 0x88) >> 3) | ((this.a & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x98, (() =>
            {
                Num sbctemp = this.a - this.b - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.b & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x99, (() =>
            {
                Num sbctemp = this.a - this.c - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.c & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9a, (() =>
            {
                Num sbctemp = this.a - this.d - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.d & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9b, (() =>
            {
                Num sbctemp = this.a - this.e - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.e & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9c, (() =>
            {
                Num sbctemp = this.a - this.h - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.h & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9d, (() =>
            {
                Num sbctemp = this.a - this.l - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.l & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9e, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8))),
                    sbctemp = this.a - bytetemp - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0x9f, (() =>
            {
                Num sbctemp = this.a - this.a - (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((this.a & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0xa0, (() =>
            {
                this.a &= this.b;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa1, (() =>
            {
                this.a &= this.c;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa2, (() =>
            {
                this.a &= this.d;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa3, (() =>
            {
                this.a &= this.e;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa4, (() =>
            {
                this.a &= this.h;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa5, (() =>
            {
                this.a &= this.l;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.a &= bytetemp;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa7, (() =>
            {
                this.a &= this.a;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa8, (() =>
            {
                this.a ^= this.b;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xa9, (() =>
            {
                this.a ^= this.c;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xaa, (() =>
            {
                this.a ^= this.d;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xab, (() =>
            {
                this.a ^= this.e;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xac, (() =>
            {
                this.a ^= this.h;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xad, (() =>
            {
                this.a ^= this.l;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xae, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.a ^= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xaf, (() =>
            {
                this.a ^= this.a;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb0, (() =>
            {
                this.a |= this.b;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb1, (() =>
            {
                this.a |= this.c;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb2, (() =>
            {
                this.a |= this.d;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb3, (() =>
            {
                this.a |= this.e;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb4, (() =>
            {
                this.a |= this.h;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb5, (() =>
            {
                this.a |= this.l;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8)));
                this.a |= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb7, (() =>
            {
                this.a |= this.a;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xb8, (() =>
            {
                Num cptemp = this.a - this.b,
                    lookup = ((this.a & 0x88) >> 3) | ((this.b & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.b & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xb9, (() =>
            {
                Num cptemp = this.a - this.c,
                    lookup = ((this.a & 0x88) >> 3) | ((this.c & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.c & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xba, (() =>
            {
                Num cptemp = this.a - this.d,
                    lookup = ((this.a & 0x88) >> 3) | ((this.d & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.d & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xbb, (() =>
            {
                Num cptemp = this.a - this.e,
                    lookup = ((this.a & 0x88) >> 3) | ((this.e & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.e & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xbc, (() =>
            {
                Num cptemp = this.a - this.h,
                    lookup = ((this.a & 0x88) >> 3) | ((this.h & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.h & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xbd, (() =>
            {
                Num cptemp = this.a - this.l,
                    lookup = ((this.a & 0x88) >> 3) | ((this.l & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.l & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xbe, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte((this.l | (this.h << 8))),
                    cptemp = this.a - bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (bytetemp & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xbf, (() =>
            {
                Num cptemp = this.a - this.a,
                    lookup = ((this.a & 0x88) >> 3) | ((this.a & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (this.a & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xc0, (() =>
            {
                this.tstates++;
                if (this.pc == 0x056c || this.pc == 0x0112)
                {
                    //if (tape_load_trap() == 0) return;
                    throw new NotImplementedException("Can't load from tapes");
                }
                if (!((this.f & 0x40) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xc1, (() =>
            {
                this.tstates += 3;
                this.c = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.b = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            _Opcodes.Add(0xc2, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!((this.f & 0x40) > 0))
                {
                    Num jptemp = this.pc,
                        pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xc3, (() =>
            {
                this.tstates += 6;
                Num jptemp = this.pc,
                    pcl = this.memory.readbyte(jptemp++);
                jptemp &= 0xffff;
                Num pch = this.memory.readbyte(jptemp);
                this.pc = pcl | (pch << 8);
            }));
            _Opcodes.Add(0xc4, (() =>
            {
                this.tstates += 6;
                if (!((this.f & 0x40) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl,
                        pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xc5, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.b);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.c);
            }));
            _Opcodes.Add(0xc6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++),
                    addtemp = this.a + bytetemp,
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((addtemp & 0x88) >> 1);
                this.a = addtemp & 0xff;
                this.f = (((addtemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0xc7, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = (0x00);
            }));
            _Opcodes.Add(0xc8, (() =>
            {
                this.tstates++;
                if ((this.f & 0x40) > 0)
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xc9, (() =>
            {
                this.tstates += 3;
                Num lowbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                Num highbyte = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                (this.pc) = lowbyte | (highbyte << 8);
            }));
            _Opcodes.Add(0xca, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if ((this.f & 0x40) > 0)
                {
                    Num jptemp = this.pc,
                        pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xcb, (() =>
            {
                Num opcode2;
                this.tstates += 4;
                opcode2 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.r = (this.r + 1) & 0x7f;
                CB_Opcodes[opcode2].Invoke();
            }));
            _Opcodes.Add(0xcc, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (((this.f & 0x40) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl,
                        pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xcd, (() =>
            {
                this.tstates += 6;
                Num calltempl, calltemph;
                calltempl = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.tstates += 1;
                calltemph = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                Num pcl = calltempl,
                    pch = calltemph;
                this.pc = pcl | (pch << 8);
            }));
            _Opcodes.Add(0xce, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++),
                    adctemp = this.a + bytetemp + (this.f & 0x01),
                    lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((adctemp & 0x88) >> 1);
                this.a = adctemp & 0xff;
                this.f = (((adctemp & 0x100) > 0) ? 0x01 : 0) | lookupTables.halfcarry_add[lookup & 0x07] | lookupTables.overflow_add[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0xcf, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = 0x08;
            }));
            _Opcodes.Add(0xd0, (() =>
            {
                this.tstates++;
                if (!((this.f & 0x01) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xd1, (() =>
            {
                this.tstates += 3;
                this.e = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.d = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            _Opcodes.Add(0xd2, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!(((this.f & 0x01) > 0)))
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xd3, (() =>
            {
                Num outtemp;
                this.tstates += 4;
                outtemp = this.memory.readbyte(this.pc++) + (this.a << 8);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.port.writeport(outtemp, this.a);
            }));
            _Opcodes.Add(0xd4, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!(((this.f & 0x01) > 0)))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl;
                    Num pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xd5, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.d);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.e);
            }));
            _Opcodes.Add(0xd6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                Num subtemp = this.a - bytetemp;
                Num lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((subtemp & 0x88) >> 1);
                this.a = subtemp & 0xff;
                this.f = (((subtemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0xd7, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = (0x10);
            }));
            _Opcodes.Add(0xd8, (() =>
            {
                this.tstates++;
                if (((this.f & 0x01) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xd9, (() =>
            {
                Num bytetemp;
                bytetemp = this.b;
                this.b = this.b_;
                this.b_ = bytetemp;
                bytetemp = this.c;
                this.c = this.c_;
                this.c_ = bytetemp;
                bytetemp = this.d;
                this.d = this.d_;
                this.d_ = bytetemp;
                bytetemp = this.e;
                this.e = this.e_;
                this.e_ = bytetemp;
                bytetemp = this.h;
                this.h = this.h_;
                this.h_ = bytetemp;
                bytetemp = this.l;
                this.l = this.l_;
                this.l_ = bytetemp;
            }));
            _Opcodes.Add(0xda, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (((this.f & 0x01) > 0))
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xdb, (() =>
            {
                Num intemp;
                this.tstates += 4;
                intemp = this.memory.readbyte(this.pc++) + (this.a << 8);
                this.pc &= 0xffff;
                this.tstates += 3;
                this.a = this.port.readport(intemp);
            }));
            _Opcodes.Add(0xdc, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (((this.f & 0x01) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl;
                    Num pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xdd, (() =>
            {
                Num opcode2;
                this.tstates += 4;
                opcode2 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.r = (this.r + 1) & 0x7f;
                DD_Opcodes[opcode2].Invoke();
            }));
            _Opcodes.Add(0xde, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                Num sbctemp = this.a - bytetemp - (this.f & 0x01);
                Num lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((sbctemp & 0x88) >> 1);
                this.a = sbctemp & 0xff;
                this.f = (((sbctemp & 0x100) > 0) ? 0x01 : 0) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | lookupTables.sz53[this.a];
            }));
            _Opcodes.Add(0xdf, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = (0x18);
            }));
            _Opcodes.Add(0xe0, (() =>
            {
                this.tstates++;
                if (!((this.f & 0x04) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xe1, (() =>
            {
                this.tstates += 3;
                this.l = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.h = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            _Opcodes.Add(0xe2, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!((this.f & 0x04) > 0))
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xe3, (() =>
            {
                Num bytetempl = this.memory.readbyte(this.sp),
                    bytetemph = this.memory.readbyte(this.sp + 1);
                this.tstates += 3;
                this.tstates += 4;
                this.tstates += 3;
                this.tstates += 5;
                this.memory.writebyte(this.sp + 1, this.h);
                this.memory.writebyte(this.sp, this.l);
                this.l = bytetempl;
                this.h = bytetemph;
            }));
            _Opcodes.Add(0xe4, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!((this.f & 0x04) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl;
                    Num pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xe5, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.h);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.l);
            }));
            _Opcodes.Add(0xe6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                this.a &= bytetemp;
                this.f = 0x10 | lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xe7, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = (0x20);
            }));
            _Opcodes.Add(0xe8, (() =>
            {
                this.tstates++;
                if ((this.f & 0x04) > 0)
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xe9, (() =>
            {
                this.pc = (this.l | (this.h << 8));
            }));
            _Opcodes.Add(0xea, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if ((this.f & 0x04) > 0)
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xeb, (() =>
            {
                Num bytetemp;
                bytetemp = this.d;
                this.d = this.h;
                this.h = bytetemp;
                bytetemp = this.e;
                this.e = this.l;
                this.l = bytetemp;
            }));
            _Opcodes.Add(0xec, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (((this.f & 0x04) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl;
                    Num pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xed, (() =>
            {
                Num opcode2;
                this.tstates += 4;
                opcode2 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.r = (this.r + 1) & 0x7f;
                ED_Opcodes[opcode2].Invoke();
            }));
            _Opcodes.Add(0xee, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                this.a ^= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xef, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = (0x28);
            }));
            _Opcodes.Add(0xf0, (() =>
            {
                this.tstates++;
                if (!((this.f & 0x80) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    (this.pc) = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xf1, (() =>
            {
                this.tstates += 3;
                this.f = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
                this.tstates += 3;
                this.a = this.memory.readbyte(this.sp++);
                this.sp &= 0xffff;
            }));
            _Opcodes.Add(0xf2, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!((this.f & 0x80) > 0))
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xf3, (() =>
            {
                this.iff1 = this.iff2 = 0;
            }));
            _Opcodes.Add(0xf4, (() =>
            {
                this.tstates += 3;
                this.tstates += 3;
                if (!((this.f & 0x80) > 0))
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) & 0xff);
                    Num pcl = calltempl;
                    Num pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xf5, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.a);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, this.f);
            }));
            _Opcodes.Add(0xf6, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                this.a |= bytetemp;
                this.f = lookupTables.sz53p[this.a];
            }));
            _Opcodes.Add(0xf7, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = 0x30;
            }));
            _Opcodes.Add(0xf8, (() =>
            {
                this.tstates++;
                if (((this.f & 0x80) > 0))
                {
                    this.tstates += 3;
                    Num lowbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    Num highbyte = this.memory.readbyte(this.sp++);
                    this.sp &= 0xffff;
                    this.pc = lowbyte | (highbyte << 8);
                }
            }));
            _Opcodes.Add(0xf9, (() =>
            {
                this.tstates += 2;
                this.sp = (this.l | (this.h << 8));
            }));
            _Opcodes.Add(0xfa, (() =>
            {
                this.tstates += 6;
                if ((this.f & 0x80) > 0)
                {
                    Num jptemp = this.pc;
                    Num pcl = this.memory.readbyte(jptemp++);
                    jptemp &= 0xffff;
                    Num pch = this.memory.readbyte(jptemp);
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xfb, (() =>
            {
                this.iff1 = this.iff2 = 1;
            }));
            _Opcodes.Add(0xfc, (() =>
            {
                this.tstates += 6;
                if ((this.f & 0x80) > 0)
                {
                    Num calltempl, calltemph;
                    calltempl = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.tstates += 1;
                    calltemph = this.memory.readbyte(this.pc++);
                    this.pc &= 0xffff;
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, (this.pc) >> 8);
                    this.sp--;
                    this.sp &= 0xffff;
                    this.tstates += 3;
                    this.memory.writebyte(this.sp, this.pc & 0xff);
                    Num pcl = calltempl,
                        pch = calltemph;
                    this.pc = pcl | (pch << 8);
                }
                else this.pc += 2;
            }));
            _Opcodes.Add(0xfd, (() =>
            {
                Num opcode2;
                this.tstates += 4;
                opcode2 = this.memory.readbyte(this.pc++);
                this.pc &= 0xffff;
                this.r = (this.r + 1) & 0x7f;
                FDOpcodes[opcode2].Invoke();
            }));
            _Opcodes.Add(0xfe, (() =>
            {
                this.tstates += 3;
                Num bytetemp = this.memory.readbyte(this.pc++);
                Num cptemp = this.a - bytetemp;
                Num lookup = ((this.a & 0x88) >> 3) | ((bytetemp & 0x88) >> 2) | ((cptemp & 0x88) >> 1);
                this.f = ((cptemp & 0x100) > 0 ? 0x01 : (cptemp > 0 ? 0 : 0x40)) | 0x02 | lookupTables.halfcarry_sub[lookup & 0x07] | lookupTables.overflow_sub[lookup >> 4] | (bytetemp & (0x08 | 0x20)) | (cptemp & 0x80);
            }));
            _Opcodes.Add(0xff, (() =>
            {
                this.tstates++;
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) >> 8);
                this.sp--;
                this.sp &= 0xffff;
                this.tstates += 3;
                this.memory.writebyte(this.sp, (this.pc) & 0xff);
                this.pc = 0x38;
            }));
            #endregion

            //    ////--------------------------------------------;

        }
    }
}
